Subject: [bug#75279] [PATCH] system: examples: Add wlgreet-sway.tmpl

From: Homo <[email-masked]>
Date: Thu, 2 Jan 2025 08:47:33 +0200

This provides proper testing for Wayland both on x86_64
and non-x86_64 hardware.

* gnu/system/examples/wlgreet-sway.tmpl: New file.
* Makefile.am (EXAMPLES): Add it.

Change-Id: I87c50ec17cf67b0cc1e741247151b3e67db8de97
---
Hi, this is slightly modified version of my /etc/config.scm

Looking at those examples again, desktop.tmpl provides
Wayland only on x86_64 in desktop.tmpl.

 Makefile.am                           |  3 +-
 gnu/system/examples/wlgreet-sway.tmpl | 97 +++++++++++++++++++++++++++
 2 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 gnu/system/examples/wlgreet-sway.tmpl

diff --git a/Makefile.am b/Makefile.am
index 908c48b4ef..485a92f172 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -489,7 +489,8 @@ EXAMPLES =					\
   gnu/system/examples/plasma.tmpl		\
   gnu/system/examples/raspberry-pi-64.tmpl	\
   gnu/system/examples/raspberry-pi-64-nfs-root.tmpl	\
-  gnu/system/examples/vm-image.tmpl
+  gnu/system/examples/vm-image.tmpl		\
+  gnu/system/examples/wlgreet-sway.tmpl
 
 GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go $(dist_noinst_DATA:%.scm=%.go)
 
diff --git a/gnu/system/examples/wlgreet-sway.tmpl b/gnu/system/examples/wlgreet-sway.tmpl
new file mode 100644
index 0000000000..f226bf3f5a
--- /dev/null
+++ b/gnu/system/examples/wlgreet-sway.tmpl
@@ -0,0 +1,97 @@
+;; -*- mode: scheme; -*-
+;; This is an operating system configuration template
+;; for a "desktop" setup with wlgreet and Sway where the
+;; root partition is encrypted with LUKS.
+
+;; For better experience you should edit home config
+;; and add (service home-sway-service-type).
+
+;; Indicate which modules to import to access the variables
+;; used in this configuration.
+(use-modules (gnu) (srfi srfi-1))
+(use-package-modules terminals wm)
+(use-service-modules base desktop networking sddm sound xorg)
+
+(operating-system
+  (locale "fi_FI.utf8")
+  (timezone "Europe/Helsinki")
+  (keyboard-layout (keyboard-layout "fi"))
+  (host-name "giksi")
+  (kernel-arguments
+    (cons*
+      "modprobe.blacklist=amdgpu,hci,i915,iwlwifi,nouveau,radeon,xe"
+      %default-kernel-arguments))
+
+  ;; The list of user accounts ('root' is implicit).
+  (users (cons* (user-account
+                  (name "homo")
+                  (comment "Homo")
+                  (group "users")
+                  (home-directory "/home/homo")
+                  (supplementary-groups '("wheel")))
+                %base-user-accounts))
+
+  ;; Add some packages for default Sway configuration.
+  ;; Press Super+Enter to get default terminal foot.
+  (packages (cons* foot
+                   swaybg
+                   swayidle
+                   swaylock
+                   %base-packages))
+
+  ;; Below is the list of system services.  To search for available
+  ;; services, run 'guix system search KEYWORD' in a terminal.
+  (services
+   (cons*
+    (service greetd-service-type
+     (greetd-configuration
+      (greeter-supplementary-groups '("video"))
+      (terminals
+       (list
+        (greetd-terminal-configuration
+         (default-session-command
+          (greetd-wlgreet-sway-session
+           (wlgreet-session
+            (greetd-wlgreet-session
+             (extra-env '(("XKB_DEFAULT_LAYOUT" . "fi")))))))
+         (terminal-switch #t)
+         (terminal-vt "1"))))))
+    (service screen-locker-service-type
+     (screen-locker-configuration
+      (name "swaylock")
+      (program (file-append swaylock "/bin/swaylock"))
+      (using-pam? #t)
+      (using-setuid? #f)))
+    (remove (lambda (service)
+              (let ((type (service-kind service)))
+                (or (memq type
+                          (list console-font-service-type
+                                gdm-service-type
+                                sddm-service-type
+                                login-service-type
+                                mingetty-service-type
+                                screen-locker-service-type)))))
+            %desktop-services)))
+  (bootloader (bootloader-configuration
+                (bootloader grub-efi-bootloader)
+                (targets (list "/boot/efi"))
+                (keyboard-layout keyboard-layout)))
+  (mapped-devices (list (mapped-device
+                          (source (uuid
+                                   "18178f67-2e23-4dbb-b05f-57108075a66d"))
+                          (target "cryptroot")
+                          (type luks-device-mapping))))
+
+  ;; The list of file systems that get "mounted".  The unique
+  ;; file system identifiers there ("UUIDs") can be obtained
+  ;; by running 'blkid' in a terminal.
+  (file-systems (cons* (file-system
+                         (mount-point "/boot/efi")
+                         (device (uuid "8A19-4286"
+                                       'fat32))
+                         (type "vfat"))
+                       (file-system
+                         (mount-point "/")
+                         (device "/dev/mapper/cryptroot")
+                         (type "ext4")
+                         (dependencies mapped-devices)) %base-file-systems)))
-- 
2.47.1