From 250565acdde098a810f03eaf72d824835e20539d Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Wed, 15 Jul 2026 22:37:29 +0000 Subject: [PATCH] [vps] Module-ify vps-system and vps-home; update Makefile targets. Convert vps-system.scm and vps-home.scm from plain Guile scripts to proper modules with #:export. Update Makefile build targets to use -L and -e syntax. Set dak shell to bash and add sudoers entry. Co-Authored-By: Claude --- Makefile | 12 +++-- vps-home.scm | 47 +++++++++++--------- vps-system.scm | 117 ++++++++++++++++++++++++++----------------------- 3 files changed, 96 insertions(+), 80 deletions(-) diff --git a/Makefile b/Makefile index 2ffe710..a6ab116 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,13 @@ system-libre: sudo GUIX_PACKAGE_PATH=`pwd` PROFILE=libre guix system reconfigure system.scm vps-home: - GUIX_PACKAGE_PATH=`pwd` guix home reconfigure vps-home.scm + GUIX_PACKAGE_PATH=`pwd` guix home reconfigure \ + -L `pwd` -e '(@ (vps-home) vps-home-environment)' . $(guix-profile)/etc/profile vps-system: - sudo GUIX_PACKAGE_PATH=`pwd` guix system reconfigure vps-system.scm + sudo GUIX_PACKAGE_PATH=`pwd` guix system reconfigure \ + -L `pwd` -e '(@ (vps-system) vps-operating-system)' # Build-only targets — validate configuration without activating. @@ -49,10 +51,12 @@ build-system-libre: guix system build system.scm build-vps-system: - GUIX_PACKAGE_PATH=`pwd` guix system build vps-system.scm + GUIX_PACKAGE_PATH=`pwd` guix system build \ + -L `pwd` -e '(@ (vps-system) vps-operating-system)' build-vps-home: - GUIX_PACKAGE_PATH=`pwd` guix home build vps-home.scm + GUIX_PACKAGE_PATH=`pwd` guix home build \ + -L `pwd` -e '(@ (vps-home) vps-home-environment)' build-vps: build-vps-system build-vps-home diff --git a/vps-home.scm b/vps-home.scm index ab12827..3832fc5 100644 --- a/vps-home.scm +++ b/vps-home.scm @@ -3,29 +3,34 @@ ;;; ;;; VPS home directory configuration. -(use-modules (gnu home) - (gnu home services) - (gnu services) - (gnu system shadow) - (conf home paseo) - (conf home claude)) +(define-module (vps-home) + #:use-module (gnu home) + #:use-module (gnu home services) + #:use-module (gnu services) + #:use-module (gnu system shadow) + #:use-module (conf home paseo) + #:use-module (conf home claude) + #:export (vps-home-environment)) -(home-environment - (packages (list claude-code paseo)) - (services - (append (list paseo-daemon-service +(define vps-home-environment + (home-environment + (packages (list claude-code paseo)) + (services + (append (list paseo-daemon-service - ;; Uncomment the shell you wish to use for your user: - ;; (service home-bash-service-type) - ;; (service home-fish-service-type) - ;; (service home-zsh-service-type) + ;; Uncomment the shell you wish to use for your user: + ;; (service home-bash-service-type) + ;; (service home-fish-service-type) + ;; (service home-zsh-service-type) + + (service home-files-service-type + `((".guile" ,%default-dotguile) + (".Xdefaults" ,%default-xdefaults))) - (service home-files-service-type - `((".guile" ,%default-dotguile) - (".Xdefaults" ,%default-xdefaults))) + (service home-xdg-configuration-files-service-type + `(("gdb/gdbinit" ,%default-gdbinit) + ("nano/nanorc" ,%default-nanorc)))) - (service home-xdg-configuration-files-service-type - `(("gdb/gdbinit" ,%default-gdbinit) - ("nano/nanorc" ,%default-nanorc)))) + %base-home-services)))) - %base-home-services))) +vps-home-environment diff --git a/vps-system.scm b/vps-system.scm index 20ee846..7eb60b9 100644 --- a/vps-system.scm +++ b/vps-system.scm @@ -6,58 +6,65 @@ ;;; Usage: ;;; guix system image --image-type=mbr-raw vps-system.scm -(use-modules (gnu) - (nongnu packages linux) - (conf vps sshd)) - -(use-service-modules networking) - -(operating-system - (host-name "vps") - (kernel linux) - (timezone "Etc/UTC") - (locale "en_US.utf8") - - ;; ── OVH-specific (permanent -- the hardware requires these) ── - - (bootloader (bootloader-configuration - (bootloader grub-bootloader) - (targets '("/dev/sda")))) - - (kernel-arguments (list "console=ttyS0 console=tty0")) - - ;; ── Filesystems ── - - (file-systems (cons (file-system - (device (uuid "38af4c98-d0f5-96b6-2fa6-251038af4c98")) - (mount-point "/") - (type "ext4")) %base-file-systems)) - - ;; ── Users ── - - (users (cons (user-account - (name "dak") - (group "users") - (supplementary-groups '("wheel")) - (home-directory "/home/dak")) %base-user-accounts)) - - ;; ── Services ── - - (services - (append (list - ;; DHCP - (service dhcpcd-service-type) - - %ssh-service - - ;; NTP - (service ntp-service-type)) - - %base-services)) - - ;; ── Sudoers: dak can reconfigure without a password ── - - (sudoers-file (plain-file "sudoers" - (string-append (plain-file-content - %sudoers-specification) - "dak ALL = NOPASSWD: ALL\n")))) +(define-module (vps-system) + #:use-module (gnu) + #:use-module (gnu packages admin) + #:use-module (gnu packages bash) + #:use-module (nongnu packages linux) + #:use-module (conf vps sshd) + #:export (vps-operating-system)) + +(use-service-modules networking shepherd) + +(define vps-operating-system + (operating-system + (host-name "vps") + (kernel linux) + (timezone "Etc/UTC") + (locale "en_US.utf8") + + ;; OVH-specific (permanent -- the hardware requires these) + + (bootloader (bootloader-configuration + (bootloader grub-bootloader) + (targets '("/dev/sda")))) + + (kernel-arguments (list "console=ttyS0 console=tty0")) + + ;; Filesystems + + (file-systems (cons (file-system + (device (uuid "38af4c98-d0f5-96b6-2fa6-251038af4c98")) + (mount-point "/") + (type "ext4")) %base-file-systems)) + + ;; Users + + (users (cons* (user-account + (name "dak") + (group "users") + (supplementary-groups '("wheel")) + (home-directory "/home/dak") + (shell (file-append bash "/bin/bash"))) + %base-user-accounts)) + + ;; Services + + (services + (append (list + ;; DHCP — OVH delivers the static IP via DHCP + (service dhcpcd-service-type) + + %ssh-service + + ;; NTP — correct time is required for Guix substitutes + (service ntp-service-type)) %base-services)) + + ;; Sudoers: dak can reconfigure without a password + + (sudoers-file (plain-file "sudoers" + (string-append (plain-file-content + %sudoers-specification) + "dak ALL = NOPASSWD: ALL\n"))))) + +vps-operating-system -- 2.47.3