summaryrefslogtreecommitdiff
path: root/systems
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-10-21 22:51:40 -0400
committerFreya Murphy <freya@freyacat.org>2024-10-21 22:51:40 -0400
commitfe5b074aae4a85340125c4c0bd4b74094a881388 (patch)
treeebd17741d9979734331fc252d834ec0efbd7725d /systems
parentupdate commit pin, use linux 6.11 (diff)
downloaddotfiles-guix-fe5b074aae4a85340125c4c0bd4b74094a881388.tar.gz
dotfiles-guix-fe5b074aae4a85340125c4c0bd4b74094a881388.tar.bz2
dotfiles-guix-fe5b074aae4a85340125c4c0bd4b74094a881388.zip
refactor system, add installer config
Diffstat (limited to '')
-rw-r--r--systems/installer.scm111
-rw-r--r--systems/kaworu.scm9
-rw-r--r--systems/shinji.scm41
3 files changed, 134 insertions, 27 deletions
diff --git a/systems/installer.scm b/systems/installer.scm
new file mode 100644
index 0000000..0fa161c
--- /dev/null
+++ b/systems/installer.scm
@@ -0,0 +1,111 @@
+; base system for creating installer images
+
+(use-modules (freya system)
+ (gnu packages disk)
+ (gnu packages linux)
+ (gnu packages cryptsetup)
+ (gnu packages file-systems)
+ (gnu services shepherd)
+ (guix modules)
+ (gnu))
+
+; copy over installer disk utilites
+
+(define %installer-disk-utilities
+ (list parted gptfdisk ddrescue
+ lvm2-static
+ cryptsetup mdadm
+ dosfstools
+ btrfs-progs
+ e2fsprogs
+ f2fs-tools
+ jfsutils
+ xfsprogs))
+
+; copy over cow store
+
+(define %backing-directory
+ ;; Sub-directory used as the backing store for copy-on-write.
+ "/tmp/guix-inst")
+
+(define cow-store-service-type
+ (shepherd-service-type
+ 'cow-store
+ (lambda _
+ (define (import-module? module)
+ ;; Since we don't use deduplication support in 'populate-store', don't
+ ;; import (guix store deduplication) and its dependencies, which
+ ;; includes Guile-Gcrypt.
+ (and (guix-module-name? module)
+ (not (equal? module '(guix store deduplication)))))
+
+ (shepherd-service
+ (requirement '(root-file-system user-processes))
+ (provision '(cow-store))
+ (documentation
+ "Make the store copy-on-write, with writes going to \
+the given target.")
+
+ ;; This is meant to be explicitly started by the user.
+ (auto-start? #f)
+
+ (modules `((gnu build install)
+ ,@%default-modules))
+ (start
+ (with-imported-modules (source-module-closure
+ '((gnu build install))
+ #:select? import-module?)
+ #~(case-lambda
+ ((target)
+ (mount-cow-store target #$%backing-directory)
+ target)
+ (else
+ ;; Do nothing, and mark the service as stopped.
+ #f))))
+ (stop #~(lambda (target)
+ ;; Delete the temporary directory, but leave everything
+ ;; mounted as there may still be processes using it since
+ ;; 'user-processes' doesn't depend on us. The 'user-file-systems'
+ ;; service will unmount TARGET eventually.
+ (delete-file-recursively
+ (string-append target #$%backing-directory))))))
+ (description "Make the store copy-on-write, with writes going to \
+the given target.")))
+
+(define (cow-store-service)
+ "Return a service that makes the store copy-on-write, such that writes go to
+the user's target storage device rather than on the RAM disk."
+ ;; See <http://bugs.gnu.org/18061> for the initial report.
+ (service cow-store-service-type 'mooooh!))
+
+; installer system
+
+(operating-system
+ (inherit base-operating-system)
+ (host-name "installer")
+
+ (file-systems
+ (append %base-live-file-systems
+ %base-file-systems))
+
+ (users (list (user-account
+ (name "root")
+ (group "root")
+ (supplementary-groups '("wheel")) ; allow use of sudo
+ (password "")
+ (comment "root"))))
+
+ (pam-services
+ ;; Explicitly allow for empty passwords.
+ (base-pam-services #:allow-empty-passwords? #t))
+
+ (packages (append %installer-disk-utilities
+ %freya-base-packages))
+
+ (services (append %freya-base-services
+ (list (cow-store-service))))
+
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (targets '("/dev/sda")))))
+
diff --git a/systems/kaworu.scm b/systems/kaworu.scm
index 254d09b..f254f6f 100644
--- a/systems/kaworu.scm
+++ b/systems/kaworu.scm
@@ -6,13 +6,13 @@
(host-name "kaworu")
(mapped-devices (list (mapped-device
- (source (uuid
- "89257280-202b-4565-b832-89f160d5e4e2"))
+ (source (uuid
+ "89257280-202b-4565-b832-89f160d5e4e2"))
(target "cryptroot")
(type luks-device-mapping))))
(file-systems (cons* (file-system
- (mount-point "/")
+ (mount-point "/")
(device "/dev/mapper/cryptroot")
(type "btrfs")
(dependencies mapped-devices))
@@ -20,4 +20,5 @@
(mount-point "/boot/efi")
(device (uuid "099A-D668"
'fat32))
- (type "vfat")) %base-file-systems)))
+ (type "vfat"))
+ %freya-file-systems)))
diff --git a/systems/shinji.scm b/systems/shinji.scm
index 0b8378b..d5333fd 100644
--- a/systems/shinji.scm
+++ b/systems/shinji.scm
@@ -2,28 +2,23 @@
(gnu))
(operating-system
- (inherit base-operating-system)
- (host-name "shinji")
+ (inherit base-operating-system)
+ (host-name "shinji")
- (kernel-arguments (append (list "intel_iommu=on")
- %default-kernel-arguments))
+ (mapped-devices (list (mapped-device
+ (source (uuid
+ "5c5dcb22-62b1-41af-9116-b8fdfba83ca2"))
+ (target "cryptroot")
+ (type luks-device-mapping))))
- (initrd-modules (cons* "vfio_pci" "vfio" "vfio_iommu_type1"
- %base-initrd-modules))
-
- (mapped-devices (list (mapped-device
- (source (uuid
- "5c5dcb22-62b1-41af-9116-b8fdfba83ca2"))
- (target "cryptroot")
- (type luks-device-mapping))))
-
- (file-systems (cons* (file-system
- (mount-point "/")
- (device "/dev/mapper/cryptroot")
- (type "btrfs")
- (dependencies mapped-devices))
- (file-system
- (mount-point "/boot/efi")
- (device (uuid "AD5A-4DF3"
- 'fat32))
- (type "vfat")) %base-file-systems)))
+ (file-systems (cons* (file-system
+ (mount-point "/")
+ (device "/dev/mapper/cryptroot")
+ (type "btrfs")
+ (dependencies mapped-devices))
+ (file-system
+ (mount-point "/boot/efi")
+ (device (uuid "AD5A-4DF3"
+ 'fat32))
+ (type "vfat"))
+ %freya-file-systems)))