Files
opalfiles/Guix.org
opalvaults 5cff46d42f stuff
2021-12-28 17:53:22 -08:00

12 KiB

Guix Configuration

I use GNU Guix as my operating system. I'm able to declare the state of the operating system in a series of configuration files in a similar way to Puppet. Eventually I would like to integrate Guix Home into this configuration.

Channels

Disclaimer: I use the nonguix channel only for the use of building Firefox from source easily.

(list (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (introduction
          (make-channel-introduction
            "9edb3f66fd807b096b48283debdcddccfea34bad"
            (openpgp-fingerprint
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"))))
      (channel
        (name 'nonguix)
        (url "https://gitlab.com/nonguix/nonguix")
        (introduction
          (make-channel-introduction
            "897c1a470da759236cc11798f4e0a5f7d4d59fbc"
            (openpgp-fingerprint
              "2A39 3FFF 68F4 EF7A 3D29  12AF 6F51 20A0 22FB B2D5")))))

System

Home Desktop

(use-modules (gnu)
             (gnu services desktop)
             (gnu packages wm)
             (gnu system setuid)
             (gnu packages admin)
             (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
   (cons (setuid-program
          (program (file-append swaylock "/bin/swaylock")))
         %setuid-programs))
  (users (cons* (user-account
                 (name "opal")
                 (comment "opal")
                 (group "users")
                 (home-directory "/home/opal")
                 (supplementary-groups
                  '("wheel"
		                "netdev"
		                "audio"
		                "video")))
                %base-user-accounts))
  (packages
   (append
       (list
        (specification->package "git")
        (specification->package "wl-clipboard")
        (specification->package "vim")
        (specification->package "nss-certs")
        (specification->package "stow")
        (specification->package "exfat-utils")
        (specification->package "emacs")
        (specification->package "emacs-exwm") 
        (specification->package "sway") 
        (specification->package "swaybg") 
        (specification->package "swaylock") 
        (specification->package "swayidle") 
        (specification->package "polybar") 
        (specification->package "nyxt")
        (specification->package "dmenu")
        (specification->package "bluez")
        (specification->package "bluez-alsa")
        (specification->package "pulseaudio")
        (specification->package "keepassxc")
        (specification->package "font-fira-mono")
        (specification->package "font-fira-sans")
        (specification->package "font-fira-code") 
        (specification->package "gcc-toolchain"))
       %base-packages))
  (services
   (append (modify-services %desktop-services
             (delete gdm-service-type))
       (list (service sddm-service-type
                      (sddm-configuration
                       (display-server "wayland"))))))
  (bootloader
   (bootloader-configuration
    (bootloader grub-efi-bootloader)
    (targets (list "/boot/efi"))
    (keyboard-layout keyboard-layout)))
  (mapped-devices
   (list (mapped-device
          (source
           (uuid "40aa6387-e935-4f70-8e7d-1975678a5a32"))
          (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 "1C3B-10F5" 'fat32))
            (type "vfat"))
          %base-file-systems)))

;; (setuid-programs
;;    (let ((from (lambda (package file)
;; 		 (setuid-program (program (file-append package file))))))
;;      (cons* (from light "/bin/light")
;; 	    (from mtr "/sbin/mtr")
;; 	    (from network-manager "/bin/nmtui")
;; 	    (from nfs-utils "/sbin/mount.nfs")
;; 	    (from swaylock "/bin/swaylock")
;; 	    %setuid-programs)))

;; (services (cons* ...
;;                  (modify-services %desktop-services
;;                    (gdm-service-type config
;;                      => (gdm-configuration
;;                          (inherit config)
;;                          (wayland? #t)
;;                          (debug? #t))))))

Work Laptop

(use-modules (gnu)
             (gnu services desktop)
             (gnu packages wm)
             (gnu system setuid)
             (gnu packages admin)
             (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"))
 (setuid-programs
  (cons (setuid-program
         (program (file-append swaylock "/bin/swaylock")))
        %setuid-programs))
 (host-name "work")
 (users (cons* (user-account
                (name "opal")
                (comment "Opal")
                (group "users")
                (home-directory "/home/opal")
                (supplementary-groups
                 '("wheel" "netdev" "audio" "video")))
               %base-user-accounts))
 (packages
  (append
   (list 
    (specification->package "git")
    (specification->package "wl-clipboard")
    (specification->package "vim")
    (specification->package "nss-certs")
    (specification->package "stow")
    (specification->package "exfat-utils")
    (specification->package "emacs")
    (specification->package "emacs-exwm") 
    (specification->package "sway") 
    (specification->package "swaybg") 
    (specification->package "swaylock") 
    (specification->package "swayidle") 
    (specification->package "polybar") 
    (specification->package "nyxt")
    (specification->package "dmenu")
    (specification->package "bluez")
    (specification->package "bluez-alsa")
    (specification->package "pulseaudio")
    (specification->package "keepassxc")
    (specification->package "font-fira-mono")
    (specification->package "font-fira-sans")
    (specification->package "font-fira-code")
    (specification->package "gcc-toolchain"))
   %base-packages)) 
  (services
   (append (modify-services %desktop-services
             (delete gdm-service-type))
       (list (service sddm-service-type
                      (sddm-configuration
                       (display-server "wayland"))))))
 (bootloader
  (bootloader-configuration
   (bootloader grub-efi-bootloader)
   (targets (list "/boot/efi"))
   (keyboard-layout keyboard-layout)))
 (mapped-devices
  (list (mapped-device
         (source
          (uuid "abe760e2-4ba5-4f43-81a2-1c3f16eb62a8"))
         (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 "15B3-5DE5" 'fat32))
          (type "vfat"))
         %base-file-systems)))

Home

(use-modules
 (gnu)
 (gnu home)
 (gnu home services)
 (gnu home services shells)
 (gnu home services shepard)
 (gnu packages libreoffice)
 (gnu packages mail)
 (gnu packages pdf))

(home-environment
 (packages
  (append
   ;; Tools/Libraries
   (list
    gcc-toolchain
    wget
    curl
    cmake
    make
    zip
    unzip
    libtool
    binutils-gold
    openssl
    openssh
    gst-plugins-bad
    gst-plugins-base
    gst-plugins-good
    gst-plugins-ugly
    gst-libav
    wl-clipboard
    zsh
    gnupg)
    ;; Applications
    (list
     alacritty
     nyxt
     zathura-pdf-mupdf
     thunar
     firefox
     wl-randr
     libreoffice
     calibre
     mpv
     youtube-dl
     icedove)
     ;; Emacs
     (list
      emacs-vterm
      emacs-geiser
      emacs-geiser-guile
      emacs-doom-modeline
      emacs-all-the-icons
      emacs-all-the-icons-dired
      emacs-general
      emacs-which-key
      emacs-alert
      emacs-helpful
      emacs-pinentry
      emacs-doom-themes
      emacs-evil
      emacs-evil-collection
      emacs-vertico
      emacs-orderless
      emacs-consult
      emacs-company
      emacs-marginalia
      emacs-perspective
      emacs-dired-rsync
      emacs-dired-hacks
      emacs-org-bullets
      emacs-org-make-toc
      emacs-visual-fill-column
      emacs-flycheck
      emacs-rainbow-mode
      emacs-rainbow-delimiters
      emacs-magit
      emacs-projectile
      emacs-lsp-mode
      emacs-lsp-ui
      emacs-treemacs
      emacs-lsp-treemacs
      emacs-parinfer
      emacs-yasnippet
      emacs-pdf-tools)
     ;; Languages
     (list
      ruby
      python
      guile
      sbcl
      perl
      python-lsp-server
      ruby-solargraph)
     ;; Aesthetics/Fonts
     (list
      papirus-icon-theme
      arc-theme
      font-fira-mono
      font-fira-code
      font-fira-sans
      font-abattis-cantarell
      font-google-noto
      font-awesome)))
 (services
  (append
   ;; Shell
   (list
    (service home-zsh-service-type
             (home-zsh-configuration
              ;; Place all configs to $XDG_CONFIG_HOME/zsh. Makes
              ;; ~/.zshenv to set ZDOTDIR to $XDG_CONFIG_HOME/zsh
              ;; and shell process starts with ~/.config/zsh/.zshenv
              (xdg-flavor? #t)
              ;; .zshenv
              (zshenv
               (list
                (local-file
                 (string-append (getenv "HOME")
                                "/Dotfiles/.config/zsh/.zshenv")
                 "/.config/zsh/.zshenv")))
              ;; .zprofile
              (zprofile
               (list
                (local-file
                 (string-append (getenv "HOME")
                                "/Dotfiles/.config/zsh/.zprofile")
                 "/.config/zsh/.zprofile")))
              (zshrc
               (list
                (local-file
                 (string-append (getenv "HOME")
                                "/Dotfiles/.config/zsh/.zshrc")
                 "/.config/zsh/.zshrc"))))))
   ;; Files
   (list
    (simple-service 'emacs-config
                    home-files-service-type
                    (list
                     `(".config/emacs/init.el"
                       ,(local-file
                         (string-append (getenv "HOME")
                                        "/Dotfiles/emacs/init.el")))))
    
    (simple-service 'nyxt-config
                    home-files-service-type
                    (list
                     `(".config/nyxt/init.lisp"
                       ,(local-file
                         (string-append (getenv "HOME")
                                        "/Dotfiles/nyxt/init.lisp")))))
    
    (simple-service 'dunst-config
                    home-files-service-type
                    (list
                     `(".config/dunst/dunstrc"
                       ,(local-file
                         (string-append (getenv "HOME")
                                        "/Dotfiles/dunst/dunstrc")))))
    
    (simple-service 'alacritty-config
                    home-files-service-type
                    (list
                     `(".config/alacritty/alacritty.yml"
                       ,(local-file
                         (string-append (getenv "HOME")
                                        "/Dotfiles/alacritty/alacritty.yml")))))
    
    (simple-service 'alacritty-config
                    )
   ;; Daemons
   (list
    (service home-shepard-service-type
             (home-shepherd-configuration
              (services
               (list
                (shepard-service
                 (provision '(emacs))
                 (start #~(make-system-constructor "emacs --daemon"))
                 (stop #~(make-system-constructor "emacsclient -e '(kill-emacs)'")))
                (shepard-service
                 (provision '(gnome-keyring-daemon))
                 (start #~(make-system-contructor "gnome-keyring-daemon --daemonize"))
                 (stop #~(make-system-contructor "pkill gnome-keyring-daemon")))))))))))