(use-modules (gnu)
             (gnu services desktop)
             (gnu packages wm)
             (gnu packages shells)
             (gnu packages version-control)
             (gnu packages emacs)
             (gnu packages gnuzilla)
             (gnu packages vim)
             (gnu packages certs)
             (gnu packages file-systems)
             (gnu packages suckless)
             (gnu packages admin)
             (gnu packages linux)
             (gnu packages audio)
             (gnu packages pulseaudio)
             (gnu packages gnome)
             (gnu system setuid)
             (nongnu packages linux))

(use-service-modules
 cups
 desktop
 networking
 ssh
 ;; sddm
 xorg)

(operating-system
 (kernel linux)
 (firmware (list linux-firmware))
 (locale "en_US.utf8")
 (timezone "America/Los_Angeles")
 (keyboard-layout (keyboard-layout "us"))
 (host-name "borges") 
 (setuid-programs
  (let ((from (lambda (package file)
                (setuid-program (program (file-append package file))))))
    (cons* (from light "/bin/light")
           (from network-manager "/bin/nmtui")
           (from sway "/bin/sway")
           (from swaylock "/bin/swaylock")
           %setuid-programs)))
 (users (cons* (user-account
                (name "opal")
                (comment "opal")
                (group "users")
                (home-directory "/home/opal")
                (shell (file-append zsh "/bin/zsh"))
                (supplementary-groups
                 '("wheel"
                   "netdev"
                   "audio"
                   "video")))
               %base-user-accounts))

 (packages (append (list git
                         gnome
                         network-manager
                         icecat
                         vim
                         nss-certs
                         exfat-utils
                         emacs
                         sway
                         swaybg
                         swaylock
                         swayidle
                         dmenu
                         bluez
                         bluez-alsa
                         pulseaudio)
                   %base-packages))


 ;; (services
 ;;  (append (modify-services %desktop-services
 ;;                           (delete gdm-service-type))
 ;;          (list (service sddm-service-type
 ;;                         (sddm-configuration
 ;;                          (display-server "wayland"))))))
 (services
  (append (modify-services %desktop-services
                   (gdm-service-type config
                     => (gdm-configuration
                         (inherit config)
                         (wayland? #t)
                         (debug? #t))))))
 (bootloader
  (bootloader-configuration
   (bootloader grub-efi-bootloader)
   (targets (list "/boot/efi"))
   (keyboard-layout keyboard-layout)))
 (mapped-devices
  (list (mapped-device
         (source
          (uuid "0eb58e93-c463-4d40-a819-4c9d594ed230"))
         (target "cryptroot")
         (type luks-device-mapping))))
 (file-systems
  (cons* (file-system
          (mount-point "/")
          (device "/dev/mapper/cryptroot")
          (type "btrfs")
          (dependencies mapped-devices))
         (file-system
          (mount-point "/boot/efi")
          (device (uuid "2AFC-9172" 'fat32))
          (type "vfat"))
         %base-file-systems)))
