commit e1963334673c2fddeda4c56d3baaf09e5c62b027
parent db00a7d3f53bc6f6a477f4dba2cb7195a48e2846
Author: Luke Willis <lukejw@loquat.dev>
Date: Wed, 18 Jun 2025 15:26:53 -0400
Add some useful system component templates
Diffstat:
2 files changed, 152 insertions(+), 0 deletions(-)
diff --git a/loquat/services.scm b/loquat/services.scm
@@ -0,0 +1,116 @@
+(define-module (loquat services)
+ #:use-module (guix gexp)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages nfs)
+ #:use-module (gnu services)
+ #:use-module (gnu services avahi)
+ #:use-module (gnu services base)
+ #:use-module (gnu services dbus)
+ #:use-module (gnu services desktop)
+ #:use-module (gnu services networking)
+ #:use-module (gnu services sound)
+ #:use-module (gnu services ssh)
+ #:use-module (gnu system)
+ #:use-module (gnu system privilege)
+ #:use-module (loquat channels)
+ #:export (%loquat-clergy-base-services
+ %loquat-desktop-services))
+
+(define %loquat-clergy-base-services
+ (append
+ (list
+ ;; Host a local substitute server
+ (service guix-publish-service-type
+ (guix-publish-configuration
+ (host "0.0.0.0") ;; Open up to any connection
+ (advertise? #t))) ;; Allow automatic detection on other systems
+ (service openssh-service-type
+ (openssh-configuration
+ (password-authentication? #f))))
+ (modify-services %base-services
+ (guix-service-type
+ config => (guix-configuration
+ (inherit config)
+ (channels %loquat-channels)
+ (substitute-urls %loquat-substitute-urls)
+ (authorized-keys %loquat-authorized-guix-keys))))))
+
+;;; This is a slimmed-down DE-agnostic version of %desktop-services.
+;;; It is meant to be built upon and does NOT include %base-services.
+;;; TODO: Cleanup
+
+(define %loquat-desktop-services
+ (list
+ ;; Screen lockers are a pretty useful thing and these are small.
+ ;;(service screen-locker-service-type
+ ;; (screen-locker-configuration
+ ;; (name "slock")
+ ;; (program (file-append slock "/bin/slock"))))
+ ;;(service screen-locker-service-type
+ ;; (screen-locker-configuration
+ ;; (name "xlock")
+ ;; (program (file-append xlockmore "/bin/xlock"))))
+
+ ;; Add udev rules for MTP devices so that non-root users can access
+ ;; them.
+ (simple-service 'mtp udev-service-type (list libmtp))
+ ;; Add udev rules for scanners.
+ (service sane-service-type)
+ ;; Add polkit rules, so that non-root users in the wheel group can
+ ;; perform administrative tasks (similar to "sudo").
+ polkit-wheel-service
+
+ ;; Allow desktop users to also mount NTFS and NFS file systems
+ ;; without root.
+ (simple-service 'mount-setuid-helpers privileged-program-service-type
+ (map file-like->setuid-program
+ (list (file-append nfs-utils "/sbin/mount.nfs")
+ (file-append ntfs-3g "/sbin/mount.ntfs-3g"))))
+
+ ;; Add some of the artwork niceties for the desktop.
+ (simple-service 'guix-artwork
+ profile-service-type
+ %base-packages-artwork)
+
+ ;; This is a volatile read-write file system mounted at /var/lib/gdm,
+ ;; to avoid GDM stale cache and permission issues.
+ ;;gdm-file-system-service
+
+ ;; Provides a nicer experience for VTE-using terminal emulators such
+ ;; as GNOME Console, Xfce Terminal, etc.
+ ;;(service vte-integration-service-type)
+
+ ;; The global fontconfig cache directory can sometimes contain
+ ;; stale entries, possibly referencing fonts that have been GC'd,
+ ;; so mount it read-only.
+ fontconfig-file-system-service
+
+ ;; NetworkManager and its applet.
+ (service network-manager-service-type)
+ (service wpa-supplicant-service-type) ;needed by NetworkManager
+ ;;(simple-service 'network-manager-applet
+ ;; profile-service-type
+ ;; (list network-manager-applet))
+ ;;(service modem-manager-service-type)
+ (service usb-modeswitch-service-type)
+
+ ;; The D-Bus clique.
+ (service avahi-service-type)
+ (service udisks-service-type)
+ (service upower-service-type)
+ (service accountsservice-service-type)
+ ;;(service cups-service-type)
+ ;;(service cups-pk-helper-service-type)
+ (service colord-service-type)
+ (service geoclue-service-type)
+ (service polkit-service-type)
+ (service elogind-service-type)
+ (service dbus-root-service-type)
+
+ (service ntp-service-type)
+
+ ;;(service x11-socket-directory-service-type)
+
+ (service pulseaudio-service-type)
+ (service alsa-service-type)))
diff --git a/loquat/system.scm b/loquat/system.scm
@@ -0,0 +1,36 @@
+(define-module (loquat system)
+ #:use-module (guix gexp)
+ #:use-module (gnu packages admin)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu system)
+ #:use-module (gnu system file-systems)
+ #:export (%loquat-file-systems
+ %loquat-swap-devices
+ %loquat-base-packages))
+
+(define %loquat-file-systems
+ (append
+ (list (file-system
+ (mount-point "/boot/efi")
+ (device (file-system-label "guix-boot"))
+ (type "vfat"))
+ (file-system
+ (mount-point "/")
+ (device (file-system-label "guix-root"))
+ (type "ext4"))
+ (file-system
+ (mount-point "/home")
+ (device (file-system-label "guix-home"))
+ (type "ext4")))
+ %base-file-systems))
+
+(define %loquat-swap-devices
+ (list (swap-space
+ (target (file-system-label "guix-swap")))))
+
+(define %loquat-base-packages
+ (append
+ (list fastfetch
+ btop
+ git-minimal)
+ %base-packages))