Rosenthal/modules/rosenthal/utils/transformations.scm
Hilton Chain 1c3aed0cdb
services: zfs: Add zfs-configuration.
* modules/rosenthal/services/file-systems.scm (<zfs-configuration>): New data
type.
Enable auto mounting and disable volumes by default.
(zfs-shepherd-service): Rename to zfs-shepherd.
No longer use one-shot services.
(zfs-service-type): Adjust accordingly.
Set default value.

* modules/rosenthal/utils/transformations.scm (rosenthal-transformation-zfs):
Allow configuration.
2025-10-20 13:44:15 +08:00

86 lines
3.2 KiB
Scheme

;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2025 Hilton Chain <hako@ultrarare.space>
(define-module (rosenthal utils transformations)
#:use-module (srfi srfi-1)
#:use-module (guix channels)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu system)
#:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (rosenthal services file-systems)
#:use-module (gnu packages package-management)
#:use-module (gnu packages file-systems)
#:export (rosenthal-transformation-guix
rosenthal-transformation-zfs))
(define* (rosenthal-transformation-guix #:key (substitutes? #t)
(channel? #t)
(guix-source? #f))
(define %rosenthal-signing-key
(plain-file "rosenthal.pub" "
(public-key
(ecc
(curve Ed25519)
(q #374EC58F5F2EC0412431723AF2D527AD626B049D657B5633AAAEBC694F3E33F9#)))"))
(define %rosenthal-channel
(channel
(name 'rosenthal)
(url "https://codeberg.org/hako/rosenthal.git")
(branch "trunk")
(introduction
(make-channel-introduction
"7677db76330121a901604dfbad19077893865f35"
(openpgp-fingerprint
"13E7 6CD6 E649 C28C 3385 4DF5 5E5A A665 6149 17F7")))))
(lambda (os)
(operating-system
(inherit os)
(services
(cons* (simple-service 'guix-moe guix-service-type
(guix-extension
(authorized-keys
(list %rosenthal-signing-key))
(substitute-urls
'("https://cache-cdn.guix.moe"))))
(modify-services (operating-system-user-services os)
(guix-service-type
config => (guix-configuration
(inherit config)
(channels
(let ((configured-channels
(guix-configuration-channels config)))
(if channel?
(cons %rosenthal-channel
(or configured-channels
%default-channels))
configured-channels)))
(guix
(if guix-source?
(guix-for-channels channels)
(guix-configuration-guix config)))))))))))
;; NOTE: Booting from ZFS requires patching Guix.
(define* (rosenthal-transformation-zfs #:key boot? (config (zfs-configuration)))
(lambda (os)
(operating-system
(inherit os)
(kernel-loadable-modules
`(,@(if boot?
`((,(package/inherit zfs
(arguments
(substitute-keyword-arguments (package-arguments zfs)
((#:linux _ #f) (operating-system-kernel os)))))
"module"))
'())
,@(operating-system-kernel-loadable-modules os)))
(services
(cons* (service zfs-service-type config)
(operating-system-user-services os))))))