refactor system, add installer config
This commit is contained in:
parent
11fedb159c
commit
fe5b074aae
4 changed files with 371 additions and 216 deletions
|
@ -38,18 +38,9 @@
|
|||
#:use-module (freya packages networking)
|
||||
#:use-module (freya packages virtualization))
|
||||
|
||||
(define-public base-operating-system
|
||||
(operating-system
|
||||
(kernel linux-6.11)
|
||||
(firmware (list linux-firmware
|
||||
amd-microcode
|
||||
sof-firmware))
|
||||
(locale "en_US.utf8")
|
||||
(timezone "America/New_York")
|
||||
(keyboard-layout (keyboard-layout "us"))
|
||||
(host-name "ThisWillChange")
|
||||
|
||||
(users (cons* (user-account
|
||||
(define-public %freya-user-accounts
|
||||
(cons* (user-account
|
||||
(name "freya")
|
||||
(comment "Freya Murphy")
|
||||
(group "users")
|
||||
|
@ -67,47 +58,23 @@
|
|||
"tty")))
|
||||
%base-user-accounts))
|
||||
|
||||
(packages (append (specifications->packages (list ; gtk
|
||||
"wxwidgets"
|
||||
"gtk+"
|
||||
"dconf"
|
||||
"gnome-themes-extra"
|
||||
"adwaita-icon-theme"
|
||||
"hicolor-icon-theme"
|
||||
|
||||
; wayland x11
|
||||
"wl-clipboard"
|
||||
"libx11"
|
||||
"xorg-server-xwayland"
|
||||
"xf86-video-qxl"
|
||||
(define-public %freya-base-packages
|
||||
(append
|
||||
|
||||
; video audio
|
||||
;; append guix and nonguix base packages
|
||||
(specifications->packages (list ; video audio
|
||||
"mesa"
|
||||
"mesa-utils"
|
||||
"glu"
|
||||
"libglvnd"
|
||||
"vulkan-loader"
|
||||
"vulkan-validationlayers"
|
||||
"vulkan-tools"
|
||||
"vulkan-headers"
|
||||
"spirv-tools"
|
||||
"spirv-headers"
|
||||
"sdl2"
|
||||
"openal"
|
||||
"freealut"
|
||||
|
||||
; xdg
|
||||
"xdg-utils"
|
||||
"xdg-desktop-portal"
|
||||
|
||||
; firmware
|
||||
"sof-firmware"
|
||||
"amd-microcode"
|
||||
"v4l2loopback-linux-module"
|
||||
|
||||
; needed programs
|
||||
"qemu"
|
||||
; terrminal
|
||||
"alsa-utils"
|
||||
"vim"
|
||||
"neovim"
|
||||
|
||||
; basic utils
|
||||
|
@ -127,7 +94,49 @@
|
|||
"ripgrep"
|
||||
"ncurses"
|
||||
"jq"
|
||||
"openssl"
|
||||
"openssl"))
|
||||
|
||||
;; append certs
|
||||
(list freya-ca-certs)
|
||||
|
||||
;; append guix base packages
|
||||
%base-packages))
|
||||
|
||||
|
||||
(define-public %freya-packages
|
||||
(append
|
||||
|
||||
;; append guix and nonguix packages
|
||||
(specifications->packages (list ; gtk
|
||||
"wxwidgets"
|
||||
"gtk+"
|
||||
"dconf"
|
||||
"gnome-themes-extra"
|
||||
"adwaita-icon-theme"
|
||||
"hicolor-icon-theme"
|
||||
|
||||
; wayland x11
|
||||
"wl-clipboard"
|
||||
"libx11"
|
||||
"xorg-server-xwayland"
|
||||
"xf86-video-qxl"
|
||||
|
||||
; video audio
|
||||
"glu"
|
||||
"libglvnd"
|
||||
"vulkan-loader"
|
||||
"vulkan-validationlayers"
|
||||
"vulkan-tools"
|
||||
"vulkan-headers"
|
||||
"spirv-tools"
|
||||
"spirv-headers"
|
||||
"sdl2"
|
||||
"openal"
|
||||
"freealut"
|
||||
|
||||
; xdg
|
||||
"xdg-utils"
|
||||
"xdg-desktop-portal"
|
||||
|
||||
; system daemons
|
||||
"docker"
|
||||
|
@ -143,7 +152,12 @@
|
|||
"font-fira-mono"
|
||||
"font-google-noto-sans-cjk"
|
||||
"font-jetbrains-mono"
|
||||
"font-dejavu"))
|
||||
"font-dejavu"
|
||||
|
||||
; misc
|
||||
"qemu"))
|
||||
|
||||
;; append custom packages
|
||||
(list ; qt
|
||||
qt5-styleplugins
|
||||
qt6gtk2
|
||||
|
@ -155,49 +169,21 @@
|
|||
pulseaudio-new
|
||||
|
||||
; system
|
||||
virt-manager-ovmf
|
||||
freya-ca-certs)
|
||||
%base-packages))
|
||||
virt-manager-ovmf)
|
||||
|
||||
(services
|
||||
(append (list
|
||||
; system
|
||||
(service nix-service-type)
|
||||
;; append freya base backages
|
||||
%freya-base-packages))
|
||||
|
||||
|
||||
(define-public %freya-base-services
|
||||
(append
|
||||
|
||||
(list ; pam
|
||||
(service pam-limits-service-type)
|
||||
(service openssh-service-type)
|
||||
; networking
|
||||
(simple-service 'wireguard-module
|
||||
kernel-module-loader-service-type
|
||||
'("wireguard"))
|
||||
; printing
|
||||
(service cups-service-type
|
||||
(cups-configuration
|
||||
(web-interface? #t)))
|
||||
(service avahi-service-type
|
||||
(avahi-configuration
|
||||
(publish? #f)
|
||||
(publish-workstation? #f)))
|
||||
; docker
|
||||
(service docker-service-type)
|
||||
(service containerd-service-type)
|
||||
; vms
|
||||
(service libvirt-service-type
|
||||
(libvirt-configuration
|
||||
(libvirt libvirt-ovmf)
|
||||
(unix-sock-group "libvirt")
|
||||
(tls-port "16555")))
|
||||
(service virtlog-service-type)
|
||||
(service spice-vdagent-service-type)
|
||||
; audio
|
||||
(service bluetooth-service-type
|
||||
(bluetooth-configuration
|
||||
(bluez bluez-new)
|
||||
(experimental #t)
|
||||
(fast-connectable? #t)))
|
||||
; yubikey
|
||||
(service pcscd-service-type)
|
||||
(udev-rules-service 'fido2 libfido2 #:groups '("plugdev")))
|
||||
; openssh
|
||||
(service openssh-service-type))
|
||||
|
||||
; base guix desktop services
|
||||
(modify-services %desktop-services
|
||||
(guix-service-type config =>
|
||||
(guix-configuration
|
||||
|
@ -217,20 +203,65 @@
|
|||
(delete alsa-service-type)
|
||||
(delete screen-locker-service-type))))
|
||||
|
||||
(name-service-switch %mdns-host-lookup-nss)
|
||||
|
||||
(setuid-programs
|
||||
(append (list (file-like->setuid-program
|
||||
(file-append
|
||||
swaylock-effects-new
|
||||
"/bin/swaylock"))
|
||||
(define-public %freya-services
|
||||
(append
|
||||
%freya-base-services
|
||||
(list ; nix
|
||||
(service nix-service-type)
|
||||
|
||||
; wirerguard
|
||||
(simple-service 'wireguard-module
|
||||
kernel-module-loader-service-type
|
||||
'("wireguard"))
|
||||
|
||||
; printing
|
||||
(service cups-service-type
|
||||
(cups-configuration
|
||||
(web-interface? #t)))
|
||||
(service avahi-service-type
|
||||
(avahi-configuration
|
||||
(publish? #f)
|
||||
(publish-workstation? #f)))
|
||||
|
||||
; docker
|
||||
(service docker-service-type)
|
||||
(service containerd-service-type)
|
||||
|
||||
; libvirt
|
||||
(service libvirt-service-type
|
||||
(libvirt-configuration
|
||||
(libvirt libvirt-ovmf)
|
||||
(unix-sock-group "libvirt")
|
||||
(tls-port "16555")))
|
||||
(service virtlog-service-type)
|
||||
(service spice-vdagent-service-type)
|
||||
|
||||
; audio
|
||||
(service bluetooth-service-type
|
||||
(bluetooth-configuration
|
||||
(bluez bluez-new)
|
||||
(experimental #t)
|
||||
(fast-connectable? #t)))
|
||||
|
||||
; yubikey
|
||||
(service pcscd-service-type)
|
||||
(udev-rules-service 'fido2 libfido2 #:groups '("plugdev")))))
|
||||
|
||||
|
||||
(define-public %freya-setuid-programs
|
||||
(append (list ; doas
|
||||
(file-like->setuid-program
|
||||
(file-append
|
||||
(specification->package "opendoas")
|
||||
"/bin/doas")))
|
||||
(delete sudo %setuid-programs)))
|
||||
; base setuid programs
|
||||
%setuid-programs))
|
||||
|
||||
(file-systems (cons*
|
||||
|
||||
(define-public %freya-file-systems
|
||||
(cons*
|
||||
; /tmp
|
||||
(file-system
|
||||
(mount-point "/tmp")
|
||||
(device "none")
|
||||
|
@ -238,6 +269,23 @@
|
|||
(check? #f))
|
||||
%base-file-systems))
|
||||
|
||||
|
||||
(define-public base-operating-system
|
||||
(operating-system
|
||||
(kernel linux-6.11)
|
||||
(firmware (list linux-firmware
|
||||
amd-microcode
|
||||
sof-firmware))
|
||||
(locale "en_US.utf8")
|
||||
(timezone "America/New_York")
|
||||
(keyboard-layout (keyboard-layout "us"))
|
||||
(host-name "ThisWillChange")
|
||||
(users %freya-user-accounts)
|
||||
(packages %freya-packages)
|
||||
(services %freya-services)
|
||||
(name-service-switch %mdns-host-lookup-nss)
|
||||
(setuid-programs %freya-setuid-programs)
|
||||
(file-systems %freya-file-systems)
|
||||
(bootloader (bootloader-configuration
|
||||
(bootloader uefi-uki-bootloader)
|
||||
(targets (list "/boot/efi"))
|
||||
|
|
111
systems/installer.scm
Normal file
111
systems/installer.scm
Normal file
|
@ -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")))))
|
||||
|
|
@ -20,4 +20,5 @@
|
|||
(mount-point "/boot/efi")
|
||||
(device (uuid "099A-D668"
|
||||
'fat32))
|
||||
(type "vfat")) %base-file-systems)))
|
||||
(type "vfat"))
|
||||
%freya-file-systems)))
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
(inherit base-operating-system)
|
||||
(host-name "shinji")
|
||||
|
||||
(kernel-arguments (append (list "intel_iommu=on")
|
||||
%default-kernel-arguments))
|
||||
|
||||
(initrd-modules (cons* "vfio_pci" "vfio" "vfio_iommu_type1"
|
||||
%base-initrd-modules))
|
||||
|
||||
(mapped-devices (list (mapped-device
|
||||
(source (uuid
|
||||
"5c5dcb22-62b1-41af-9116-b8fdfba83ca2"))
|
||||
|
@ -26,4 +20,5 @@
|
|||
(mount-point "/boot/efi")
|
||||
(device (uuid "AD5A-4DF3"
|
||||
'fat32))
|
||||
(type "vfat")) %base-file-systems)))
|
||||
(type "vfat"))
|
||||
%freya-file-systems)))
|
||||
|
|
Loading…
Reference in a new issue