Skip to content

Instantly share code, notes, and snippets.

@hugobuddel
Created October 20, 2023 08:51
Show Gist options
  • Save hugobuddel/cd08fc2980c6901ff4a2df5c57531e46 to your computer and use it in GitHub Desktop.
Save hugobuddel/cd08fc2980c6901ff4a2df5c57531e46 to your computer and use it in GitHub Desktop.
Guix sway config
;; Indicate which modules to import to access the variables
;; used in this configuration.
(use-modules (gnu)
(gnu packages admin)
(gnu packages certs)
(gnu packages wm)
(gnu services base)
(gnu services dbus)
(gnu services desktop)
(gnu services games)
(gnu packages libusb)
(gnu packages linux)
(gnu services networking)
(gnu services pm)
(gnu services sound)
(gnu services ssh)
(gnu services virtualization)
(gnu system)
(gnu system setuid)
(guix channels)
(guix download)
(guix gexp)
(guix inferior)
(guix packages)
(srfi srfi-1)
(gnu services desktop)
;; guixrus is used by unmatchedparenthesis
;; (guixrus packages wayland-xyz)
(gnu packages wm)
)
;; Import nonfree linux module because otherwise hardware accelaration
;; does not work and sway/wayland refuses to start.
(use-modules (nongnu packages linux)
(nongnu system linux-initrd))
;; Helper function copied from unmatchedparenthesis. Not used at the moment.
(define %conf-dir
(dirname (current-filename)))
(define* (path-join #:rest args)
(string-join args "/"))
(define (config-file file)
(local-file (path-join %conf-dir file)))
(use-service-modules cups desktop networking ssh xorg)
;; Privileged programs copied from unmatchedparenthesis; not sure whether it is needed.
(define %privileged-programs
(list
;;(file-append swaylock-effects "/bin/swaylock")
;; swaylock triggers this error:
;; [source/pam.c:16] swaylock is setuid, but was compiled with the PAM backend. Run 'chmod a-s swaylock' to fix. Aborting.
(file-append shepherd "/sbin/halt")
(file-append shepherd "/sbin/reboot")))
(operating-system
;; Load non-free kernel in order to start wayland/sway.
(kernel linux)
(initrd microcode-initrd)
(firmware (list linux-firmware))
(locale "en_US.utf8")
(timezone "Europe/Amsterdam")
(keyboard-layout (keyboard-layout "us" "dvorak-intl"))
(host-name "luca")
;; The list of user accounts ('root' is implicit).
(users (cons* (user-account
(name "hugo")
(comment "Hugo")
(group "users")
(home-directory "/home/hugo")
;; "seat" group added for seatd
;; (supplementary-groups '("wheel" "netdev" "audio" "video")))
(supplementary-groups '("wheel" "seat" "netdev" "audio" "video")))
(user-account
(name "hugotest")
(comment "Hugo Test")
(group "users")
(home-directory "/home/hugotest")
(supplementary-groups '("wheel" "seat" "netdev" "audio" "video")))
;; (supplementary-groups '("wheel" "netdev" "audio" "video")))
%base-user-accounts))
(packages (append (list ;; (specification->package "openbox")
;; (specification->package "awesome")
;; (specification->package "i3-wm")
;; (specification->package "i3status")
;; (specification->package "dmenu")
;; (specification->package "st")
;; (specification->package "ratpoison")
(specification->package "sway")
;; sway-latest is used by unmatchedparenthesis, but not sure what channel it is from
;; (specification->package "sway-latest")
(specification->package "swaybg")
(specification->package "swayidle")
(specification->package "swaylock")
(specification->package "swaylock-effects")
(specification->package "bemenu")
(specification->package "ranger")
(specification->package "termite")
;; xf86-input-synaptics might allow touchpad tapping
(specification->package "xf86-input-synaptics")
(specification->package "xterm")
(specification->package "git")
(specification->package "emacs")
(specification->package "emacs-exwm")
(specification->package "emacs-desktop-environment")
(specification->package "nss-certs")) %base-packages))
(setuid-programs
(append (map (lambda (prog)
(setuid-program
(program prog)))
%privileged-programs)
%setuid-programs))
;; Below is the list of system services. To search for available
;; services, run 'guix system search KEYWORD' in a terminal.
(services
(append (list
;; gnome disabled in favor of sway
;;(service gnome-desktop-service-type)
(service greetd-service-type
(greetd-configuration
(greeter-supplementary-groups
(list "video" "input" "seat"))
(terminals
(list (greetd-terminal-configuration
(terminal-vt "1")
(terminal-switch #t)
(default-session-command
(greetd-wlgreet-sway-session
;; (sway sway-latest)
(sway sway)
(wlgreet-session
(greetd-wlgreet-session
;; (command (file-append sway-latest "/bin/sway"))))
(command (file-append sway "/bin/sway"))))
;; No sway-greetd.conf yet in use.
;; (sway-configuration
;; (config-file "sway-greetd.conf"))
)))
(greetd-terminal-configuration
(terminal-vt "2")
(terminal-switch #t))
(greetd-terminal-configuration
(terminal-vt "3")
(terminal-switch #t))
(greetd-terminal-configuration
(terminal-vt "4")
(terminal-switch #t))
(greetd-terminal-configuration
(terminal-vt "5")
(terminal-switch #t))
(greetd-terminal-configuration
(terminal-vt "6")
(terminal-switch #t))))
))
(service seatd-service-type)
(service wpa-supplicant-service-type)
(service network-manager-service-type)
(service tlp-service-type)
;; (service xfce-desktop-service-type)
;; (service mate-desktop-service-type)
;; (service enlightenment-desktop-service-type)
;; To configure OpenSSH, pass an 'openssh-configuration'
;; record as a second argument to 'service' below.
;; (service openssh-service-type)
;; (set-xorg-configuration
;; (xorg-configuration (keyboard-layout keyboard-layout)))
;; (service pulseaudio-service-type)
)
;; The default list of services is disabled because some of those are not desired.
;; %desktop-services
(modify-services %base-services
(delete agetty-service-type)
;; unmatchedparenthesis disabled 6 mingetty-service-types,
;; (one for each terminal?), but this seems to lead to
;; problems, so delete only one.
;; but this seems to lead to
;; (delete mingetty-service-type)
;; (delete mingetty-service-type)
;; (delete mingetty-service-type)
;; (delete mingetty-service-type)
;; (delete mingetty-service-type)
(delete mingetty-service-type)
(guix-service-type config =>
(guix-configuration
(inherit config)
(substitute-urls
(cons* "https://substitutes.nonguix.org"
"https://guix.tobias.gr"
%default-substitute-urls))
(authorized-keys
(cons* (origin
(method url-fetch)
(uri "https://substitutes.nonguix.org/signing-key.pub")
(file-name "nonguix.pub")
(sha256
(base32
"0j66nq1bxvbxf5n8q2py14sjbkn57my0mjwq7k1qm9ddghca7177")))
;; Not sure what the tobias channel is, so disabled.
;; (origin
;; (method url-fetch)
;; (uri "https://guix.tobias.gr/signing-key.pub")
;; (file-name "tobias.pub")
;; (sha256
;; (base32
;; "0m51azgj3xas6f598d5mq9716v57zw745dr8bwn4cki2p8l4inlg")))
%default-authorized-guix-keys))))
)
))
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(targets (list "/boot/efi"))
(keyboard-layout keyboard-layout)
))
(mapped-devices (list (mapped-device
(source (uuid "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"))
(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 "xxxx-xxxx"
'fat32))
(type "vfat"))
(file-system
(mount-point "/")
(device "/dev/mapper/cryptroot")
(type "ext4")
(dependencies mapped-devices)) %base-file-systems)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment