From 54f433e88e8e3333eef54f7161f35114e25374b1 Mon Sep 17 00:00:00 2001 From: "Christopher R. Nelson" Date: Sun, 18 Jan 2026 21:52:31 -0500 Subject: Initial commit --- crn/system/base.scm | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 crn/system/base.scm (limited to 'crn/system/base.scm') diff --git a/crn/system/base.scm b/crn/system/base.scm new file mode 100644 index 0000000..e1bd12a --- /dev/null +++ b/crn/system/base.scm @@ -0,0 +1,103 @@ +(define-module (system base) + #:export (make-system)) + +(use-modules (gnu) + (gnu system setuid) + (nongnu packages linux) + (nongnu system linux-initrd)) +(use-package-modules avahi bash nfs) +(use-service-modules admin avahi cups dbus desktop networking nfs ssh xorg) + +(define-public (make-swap swap-devices) + (map (lambda (x) + (swap-space + (target x))) + swap-devices)) + +(define-public (make-fs mount-point fs-device fs-type) + (file-system + (mount-point mount-point) + (device fs-device) + (type fs-type))) + +(define* (make-system #:key + (use-nonguix? #f) + host-name + (locale "en_US.utf8") + (timezone "UTC") + (kbd-layout "us") + user-login + user-fullname + (packages '()) + swap-device + root-device + efi-device + role) + (operating-system + (kernel (if use-nonguix? + linux + linux-libre)) + (initrd (if use-nonguix? + microcode-initrd + base-initrd)) + (firmware (if use-nonguix? + (list linux-firmware) + '())) + + (host-name host-name) + (locale locale) + (timezone timezone) + (keyboard-layout (keyboard-layout kbd-layout)) + (name-service-switch %mdns-host-lookup-nss) + + (users (cons* (user-account + (name user-login) + (comment user-fullname) + (group "users") + (home-directory "/home/christopher") + (supplementary-groups '("wheel" "netdev" "audio" "video"))) + %base-user-accounts)) + + (packages (append (specifications->packages packages) + %base-packages)) + + (setuid-programs + (append (list (setuid-program + (program (file-append nfs-utils "/sbin/mount.nfs")))) + %setuid-programs)) + + (services + (append (list + (service dhcpcd-service-type) + (service nfs-service-type (nfs-configuration)) + (service avahi-service-type (avahi-configuration)) + (service openssh-service-type + (openssh-configuration + (password-authentication? #f))) + (service ntp-service-type) + (service package-database-service-type) + (service unattended-upgrade-service-type)) + + (if use-nonguix? + (modify-services %base-services + (guix-service-type config => + (guix-configuration + (inherit config) + (substitute-urls + (append (list "https://substitutes.nonguix.org") + %default-substitute-urls)) + (authorized-keys + (append (list (local-file "./nonguix-signing-key.pub")) + %default-authorized-guix-keys))))) + %base-services))) + + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + + (swap-devices swap-device) + (file-systems + (cons* root-device + efi-device + %base-file-systems)))) -- cgit v1.2.3