]> git.ekhem.eu.org Git - guix.git/commitdiff
[vps] Module-ify vps-system and vps-home;
authorJakub Czajka <jakub@ekhem.eu.org>
Wed, 15 Jul 2026 22:37:29 +0000 (22:37 +0000)
committerJakub Czajka <jakub@ekhem.eu.org>
Wed, 15 Jul 2026 22:37:29 +0000 (22:37 +0000)
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 <noreply@anthropic.com>
Makefile
vps-home.scm
vps-system.scm

index 2ffe710ea4abe55b117f6bf0d9c7a57e8e5376ff..a6ab11605421bd4d933b406f046ed86b9fad4d5a 100644 (file)
--- 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
 
index ab12827eded840aa3ad3125d3f1f201816d580e3..3832fc5dbe4fb0a978a8b572d785cdd8e1ad23f4 100644 (file)
@@ -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
index 20ee8466941e1e196d164a1f7fd893d31a2ecbb9..7eb60b9bb0e540099d81fcede43e9956d6491b0c 100644 (file)
@@ -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