From 29f15a0b7ecf30724129590b1e1a5fddbb0404e0 Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Sat, 20 Jun 2026 22:17:47 +0200 Subject: [PATCH] [home][system] Introduce a nonfree configuration. Pull nonguix guix channel. Select configuration through $PROFILE. --- Makefile | 15 ++- README | 12 ++ conf/home/guix.scm | 13 ++ conf/system/desktop.scm | 32 ++++- guix/.config/guix/channels.scm | 10 ++ home.scm | 52 ++++---- system.scm | 217 ++++++++++++++++++--------------- 7 files changed, 228 insertions(+), 123 deletions(-) create mode 100644 conf/home/guix.scm create mode 100644 guix/.config/guix/channels.scm diff --git a/Makefile b/Makefile index b1660d2..f1136d0 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,19 @@ guix-profile := ~/.guix-home/profile guix-store := /gnu/store guix-version := $(shell guix show guix | sed -n '/^version/s/^.*: //gp') -home: - GUIX_PACKAGE_PATH=`pwd` guix home reconfigure home.scm +home-nonfree: + GUIX_PACKAGE_PATH=`pwd` PROFILE=nonfree guix home reconfigure home.scm . $(guix-profile)/etc/profile -system: - sudo GUIX_PACKAGE_PATH=`pwd` guix system reconfigure system.scm +home-libre: + GUIX_PACKAGE_PATH=`pwd` PROFILE=libre guix home reconfigure home.scm + . $(guix-profile)/etc/profile + +system-nonfree: + sudo GUIX_PACKAGE_PATH=`pwd` PROFILE=nonfree guix system reconfigure system.scm + +system-libre: + sudo GUIX_PACKAGE_PATH=`pwd` PROFILE=libre guix system reconfigure system.scm tags: find $(guix-store) -wholename "*guix-$(guix-version)*.scm" -or \ diff --git a/README b/README index 0a911a7..db3d3f8 100644 --- a/README +++ b/README @@ -5,6 +5,18 @@ System and home directory configuration for the GNU Guix operating system. It installs programs and their configuration files (dotfiles). See Makefile for installation instructions. +Bootstrap +--------- + +guix/.config/guix/channels.scm declares third-party channels needed to build the +configuration (e.g., nonguix). Before the first guix pull, copy it into place: + +$ mkdir --parents ~/.config/guix +$ cp guix/.config/guix/channels.scm ~/.config/guix/channels.scm +$ guix pull + +After fetching channels, guix home reconfigure takes over managing the file. + Files ----- diff --git a/conf/home/guix.scm b/conf/home/guix.scm new file mode 100644 index 0000000..6f858d1 --- /dev/null +++ b/conf/home/guix.scm @@ -0,0 +1,13 @@ +;; Copyright (c) 2026 Jakub Czajka +;; License: GPL-3.0 or later. +;; +;; guix.scm - configuration for GNU Guix. + +(define-module (conf home guix) + #:use-module (conf home symlink) + #:use-module (gnu home services) + #:export (channels-service)) + +(define channels-service + (service home-symlink-service-type + (list "guix/.config/guix/channels.scm"))) diff --git a/conf/system/desktop.scm b/conf/system/desktop.scm index 626982b..3e0e928 100644 --- a/conf/system/desktop.scm +++ b/conf/system/desktop.scm @@ -8,12 +8,17 @@ #:use-module (conf common suckless) #:use-module (gnu packages fonts) #:use-module (gnu packages suckless) + #:use-module (gnu services) + #:use-module (gnu services desktop) + #:use-module (gnu services networking) #:use-module (gnu services xorg) #:use-module (gnu system keyboard) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix packages) - #:export (dwm-desktop-packages - keyboard-layout-service)) + #:export (dwm-desktop-packages %custom-desktop-services + %gdm-wayland-disabled %resolv-conf-service + keyboard-layout-service)) (define dmenu-libxft-bgra (package @@ -56,6 +61,29 @@ (xorg-configuration (keyboard-layout (keyboard-layout "pl"))))) +(define %gdm-wayland-disabled + (gdm-configuration (inherit (gdm-configuration)) + (wayland? #f))) + +(define %network-manager-encrypted-dns + (let* ((dns-tls-file (plain-file "90-dns-over-tcp.conf" + "[connection]\nconnection.dns-over-tls=2\n")) + (dns-tls-config `(("90-dns-over-tcp.conf" ,dns-tls-file)))) + (network-manager-configuration (inherit (network-manager-configuration)) + (dns "none") + (extra-configuration-files dns-tls-config)))) + +(define %resolv-conf-service + (let* ((guix-path (getenv "GUIX_PACKAGE_PATH")) + (resolv-conf (local-file (string-append guix-path + "/dns/etc/resolv.conf"))) + (etc-files (list `("resolv.conf" ,resolv-conf)))) + (simple-service 'resolv etc-service-type etc-files))) + +(define %custom-desktop-services + (modify-services %desktop-services + (gdm-service-type config => %gdm-wayland-disabled) + (network-manager-service-type config => %network-manager-encrypted-dns))) (define dwm-desktop-packages (list dmenu-libxft-bgra diff --git a/guix/.config/guix/channels.scm b/guix/.config/guix/channels.scm new file mode 100644 index 0000000..53dffd0 --- /dev/null +++ b/guix/.config/guix/channels.scm @@ -0,0 +1,10 @@ +(cons* (channel + (name 'nonguix) + (url "https://gitlab.com/nonguix/nonguix") + (branch "master") + (introduction + (make-channel-introduction + "897c1a470da759236cc11798f4e0a5f7d4d59fbc" + (openpgp-fingerprint + "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5")))) + %default-channels) diff --git a/home.scm b/home.scm index 14eb8cd..8cedf90 100644 --- a/home.scm +++ b/home.scm @@ -1,26 +1,36 @@ -;; Copyright (c) 2022-2024 Jakub Czajka +;; Copyright (c) 2022-2026 Jakub Czajka ;; License: GPL-3.0 or later. ;; ;; home.scm - home directory configuration for GNU Guix. +;; +;; Set PROFILE to select free-software stance: +;; PROFILE=nonfree -- allows non-free software. +;; PROFILE=libre -- free software only. -(use-modules (conf home bash) - (conf home emoji) - (conf home desktop) - (conf home emacs) - (conf home notify) - (conf home suckless) - (gnu packages gnuzilla)) +(use-modules (gnu home) + (conf home bash) + (conf home emoji) + (conf home desktop) + (conf home emacs) + (conf home guix) + (conf home notify) + (conf home suckless) + (gnu packages gnuzilla) + (nongnu packages mozilla)) -(home-environment - (packages - (list icecat-minimal - select-emoji - st-libxft-bgra)) - (services - (append - (list autorandr-service - notify-service - screenshot-service) - bash-services - desktop-services - emacs-services))) +(let ((profile (string->symbol (or (getenv "PROFILE") "nonfree")))) + (home-environment + (packages (case profile + ((nonfree) + (list firefox select-emoji st-libxft-bgra)) + ((libre) + (list icecat-minimal select-emoji st-libxft-bgra)))) + (services + (case profile + ((nonfree) + (append (list autorandr-service channels-service notify-service + screenshot-service) bash-services desktop-services + emacs-services)) + ((libre) + (append (list autorandr-service notify-service screenshot-service) + bash-services desktop-services emacs-services)))))) diff --git a/system.scm b/system.scm index d17f8d2..c25220d 100644 --- a/system.scm +++ b/system.scm @@ -1,110 +1,135 @@ -;; Copyright (c) 2022-2025 Jakub Czajka +;; Copyright (c) 2022-2026 Jakub Czajka ;; License: GPL-3.0 or later. ;; ;; system.scm - system configuration for GNU Guix. +;; +;; Set PROFILE to select free-software stance: +;; PROFILE=nonfree — allows non-free firmware. +;; PROFILE=libre — free software only. (use-modules (conf system bluetooth) (conf system desktop) (conf system volume) (gnu) - (gnu services networking) - (gnu services xorg) + (gnu system) (gnu system nss)) -(use-package-modules base - certs - linux - pulseaudio - xdisorg) +(use-package-modules base certs linux pulseaudio xdisorg) -(use-service-modules desktop) +(use-service-modules desktop networking xorg) (use-system-modules setuid) -(define etc-files - (list `("resolv.conf" - ,(local-file - (string-concatenate - (list (getenv "GUIX_PACKAGE_PATH") - "/dns/etc/resolv.conf")))))) - -(operating-system - (kernel linux-libre) - (keyboard-layout - (keyboard-layout "us")) - (bootloader - (bootloader-configuration - (bootloader - (bootloader - (inherit grub-bootloader) - (installer #~(const #t)))) - (keyboard-layout keyboard-layout))) - (host-name "machine") - (mapped-devices - (list (mapped-device - (source - (uuid "565d174f-3d96-45a1-8bef-fdab38e4d35a")) - (target "fde") - (type luks-device-mapping)) - (mapped-device - (source "matrix") - (targets - (list "matrix-rootvol" "matrix-swapvol")) - (type lvm-device-mapping)))) - (file-systems - (append - (list (file-system - (type "ext4") - (mount-point "/") - (device (file-system-label "root")) - (flags '(no-atime)) - (needed-for-boot? #t) - (dependencies mapped-devices))) - %base-file-systems)) - (swap-devices - (list (file-system-label "swap"))) - (users - (append - (list (user-account - (name "dak") - (group "users") - (supplementary-groups - (list "audio" "cdrom" "lp" "netdev" "tape" "video" "wheel")))) - %base-user-accounts)) - (packages - (append - (list gnu-make - bluez - pulseaudio - volume) - dwm-desktop-packages - %base-packages)) - (timezone "Europe/Warsaw") - (locale "en_US.UTF-8") - (name-service-switch %mdns-host-lookup-nss) - (setuid-programs - (cons* - (setuid-program - (program (file-append xsecurelock "/libexec/xsecurelock/authproto_pam"))) - %setuid-programs)) - (services - (append - (list bluez-service - (simple-service 'resolv - etc-service-type - etc-files) - keyboard-layout-service) - (modify-services %desktop-services - (gdm-service-type config => - (gdm-configuration - (inherit config) - (wayland? #f))) - (network-manager-service-type config => - (network-manager-configuration - (inherit config) - (dns "none") - (extra-configuration-files - `(("90-dns-over-tcp.conf" ,(plain-file "90-dns-over-tcp.conf" - "\ -[connection] -connection.dns-over-tls=2\n")))))))))) +(use-modules (nongnu packages linux) + (nongnu system linux-initrd)) +(use-modules (gnu system linux-initrd)) + +(let ((profile (string->symbol (or (getenv "PROFILE") "nonfree")))) + (operating-system + (initrd (case profile + ((nonfree) + microcode-initrd) + ((libre) + base-initrd))) + + (kernel (case profile + ((nonfree) + linux) + ((libre) + linux-libre))) + + (firmware (case profile + ((nonfree) + (list linux-firmware)) + ((libre) + '()))) + + (locale "en_US.UTF-8") + (timezone "Europe/Warsaw") + + (keyboard-layout (keyboard-layout "us")) + + (host-name "dak") + (users (append (list (user-account + (name "dak") + (group "users") + (supplementary-groups '("audio" "cdrom" + "lp" + "netdev" + "tape" + "video" + "wheel")))) + %base-user-accounts)) + + (bootloader (case profile + ((nonfree) + (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets '("/boot/efi")) + (keyboard-layout keyboard-layout))) + ((libre) + (bootloader-configuration + (bootloader (bootloader (inherit grub-bootloader) + (installer #~(const #t)))) + (keyboard-layout keyboard-layout))))) + + (mapped-devices (case profile + ((nonfree) + (list (mapped-device + (source (uuid + "b8be09cf-d416-4a49-ab69-173ee227acb6")) + (target "root") + (type luks-device-mapping)))) + ((libre) + (list (mapped-device + (source (uuid + "565d174f-3d96-45a1-8bef-fdab38e4d35a")) + (target "root") + (type luks-device-mapping)) + (mapped-device + (source "matrix") + (targets (list "matrix-rootvol" + "matrix-swapvol")) + (type lvm-device-mapping)))))) + + (file-systems (append (case profile + ((nonfree) + (list (file-system + (type "ext4") + (mount-point "/") + (device (file-system-label "root")) + (dependencies mapped-devices)) + (file-system + (type "vfat") + (mount-point "/boot/efi") + (device (file-system-label "EFI")) + (needed-for-boot? #t)))) + ((libre) + (list (file-system + (type "ext4") + (mount-point "/") + (device (file-system-label "root")) + (flags '(no-atime)) + (needed-for-boot? #t) + (dependencies mapped-devices))))) + %base-file-systems)) + + (swap-devices (list (swap-space + (target (file-system-label "swap")) + (dependencies mapped-devices)))) + + (name-service-switch %mdns-host-lookup-nss) + + (setuid-programs (let* ((xsecurelock-path + "/libexec/xsecurelock/authproto_pam") + (xsecurelock-auth (file-append xsecurelock + xsecurelock-path))) + (cons* (setuid-program (program xsecurelock-auth)) + %setuid-programs))) + + (packages (append (list gnu-make bluez pulseaudio volume) + dwm-desktop-packages %base-packages)) + + (services + (append (list bluez-service %resolv-conf-service keyboard-layout-service) + %custom-desktop-services)))) -- 2.47.3