2023-12-01 14:30:07 +00:00
|
|
|
# -*- geiser-scheme-implementation: guile -*-
|
2023-11-29 12:52:46 +00:00
|
|
|
#+TITLE: GUIX System Configuration
|
2023-12-01 13:22:33 +00:00
|
|
|
#+AUTHOR: Daniel Ziltener
|
2023-12-01 14:48:18 +00:00
|
|
|
#+PROPERTY: scheme-implementation guile
|
2023-12-01 13:22:33 +00:00
|
|
|
#+PROPERTY: header-args:scheme :comments both
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp :results none
|
|
|
|
(org-babel-lob-ingest "./library.org")
|
|
|
|
#+end_src
|
2023-11-29 12:52:46 +00:00
|
|
|
|
|
|
|
* Modules
|
|
|
|
|
|
|
|
#+NAME: module-list
|
|
|
|
- gnu
|
2023-12-01 13:32:56 +00:00
|
|
|
- gnu image
|
|
|
|
- gnu services authentication
|
2023-11-29 12:52:46 +00:00
|
|
|
- gnu services base
|
2023-12-01 13:22:33 +00:00
|
|
|
- gnu services dbus
|
2023-11-29 12:52:46 +00:00
|
|
|
- gnu services desktop
|
2023-12-01 13:22:33 +00:00
|
|
|
- gnu services linux
|
2023-11-29 12:52:46 +00:00
|
|
|
- gnu services networking
|
|
|
|
- gnu services pm
|
2023-12-01 13:22:33 +00:00
|
|
|
- gnu services virtualization
|
|
|
|
- gnu services xorg
|
2023-11-29 12:52:46 +00:00
|
|
|
- gnu system nss
|
|
|
|
|
2023-12-01 13:27:53 +00:00
|
|
|
#+begin_src scheme :noweb yes :exports none :results code pp :tangle config.scm
|
2023-12-01 13:32:56 +00:00
|
|
|
<<list-to-use(use-call="use-modules",entries=module-list,all-parens=1)>>
|
2023-12-01 13:22:33 +00:00
|
|
|
#+end_src
|
|
|
|
|
2023-11-29 12:52:46 +00:00
|
|
|
** Service Modules
|
|
|
|
|
|
|
|
#+NAME: service-module-list
|
|
|
|
- desktop
|
2023-12-01 13:22:33 +00:00
|
|
|
- xorg
|
|
|
|
|
2023-12-01 13:27:53 +00:00
|
|
|
#+begin_src scheme :noweb yes :exports none :results code pp :tangle config.scm
|
2023-12-01 13:22:33 +00:00
|
|
|
<<list-to-use(use-call="use-service-modules",entries=service-module-list)>>
|
|
|
|
#+end_src
|
2023-11-29 12:52:46 +00:00
|
|
|
|
|
|
|
** Package Modules
|
|
|
|
|
|
|
|
#+NAME: package-module-list
|
|
|
|
- bootloaders
|
|
|
|
- certs
|
|
|
|
- emacs
|
2023-12-01 13:22:33 +00:00
|
|
|
- emacs-xyz
|
|
|
|
- fonts
|
|
|
|
- readline
|
|
|
|
- terminals
|
|
|
|
- version-control
|
2023-11-29 12:52:46 +00:00
|
|
|
- wm
|
|
|
|
- xorg
|
|
|
|
|
2023-12-01 13:27:53 +00:00
|
|
|
#+begin_src scheme :noweb yes :exports none :results code pp :tangle config.scm
|
2023-12-01 13:22:33 +00:00
|
|
|
<<list-to-use(use-call="use-package-modules",entries=package-module-list)>>
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Configuration Definitions
|
|
|
|
|
|
|
|
** File System
|
|
|
|
|
|
|
|
The variable ~%local-filesystem~ extracts the file system definitions from the installer-provided
|
|
|
|
=config.scm= file.
|
|
|
|
|
|
|
|
#+begin_src scheme :tangle config.scm
|
|
|
|
(define %local-filesystem
|
|
|
|
(call-with-input-file "/etc/config.scm"
|
|
|
|
(lambda (port)
|
|
|
|
(read port)
|
|
|
|
(read port)
|
|
|
|
(eval (cadar (last-pair (read port)))
|
|
|
|
(interaction-environment)))))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
As a sibling to the former, the variable ~%local-swap~ does the same with the swap partition.
|
|
|
|
|
|
|
|
#+begin_src scheme :tangle config.scm
|
|
|
|
(define %local-swap
|
|
|
|
(call-with-input-file "/etc/config.scm"
|
|
|
|
(lambda (port)
|
|
|
|
(read port)
|
|
|
|
(read port)
|
|
|
|
(let* ((os-list (read port))
|
|
|
|
(os-list-length (length os-list)))
|
|
|
|
(eval
|
2023-12-01 13:34:09 +00:00
|
|
|
(cadr
|
2023-12-01 13:22:33 +00:00
|
|
|
(list-ref os-list
|
|
|
|
(- os-list-length 2)))
|
|
|
|
(interaction-environment))))))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Packages
|
|
|
|
|
|
|
|
#+NAME: root-packages
|
|
|
|
- emacs
|
|
|
|
- emacs-desktop-environment
|
|
|
|
- font-terminus
|
|
|
|
- git
|
|
|
|
- nss-certs
|
|
|
|
- readline
|
|
|
|
- swayfx
|
|
|
|
|
|
|
|
#+NAME: root-package-block
|
|
|
|
#+begin_src scheme :noweb no-export
|
|
|
|
(packages
|
|
|
|
(append
|
|
|
|
<<org-to-scheme-sym-list(input=root-packages)>>
|
|
|
|
%base-packages))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Services
|
|
|
|
|
|
|
|
#+NAME: root-services-block
|
|
|
|
#+begin_src scheme :noweb yes :exports none :results code
|
|
|
|
(services
|
|
|
|
(append
|
|
|
|
(modify-services
|
|
|
|
%desktop-services
|
|
|
|
(delete login-service-type)
|
|
|
|
(delete mingetty-service-type)
|
|
|
|
(delete console-font-service-type))
|
2023-12-01 13:38:40 +00:00
|
|
|
<<root-simple-service-block>>
|
|
|
|
(list
|
|
|
|
<<greeter-service>>)
|
|
|
|
(list
|
|
|
|
<<screen-lock-service>>)
|
|
|
|
))
|
2023-12-01 13:22:33 +00:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
*** Simple Services
|
|
|
|
|
|
|
|
These services are unmodified, or have just few settings.
|
|
|
|
|
|
|
|
#+NAME: root-simple-services
|
|
|
|
| Service | Options |
|
|
|
|
|-------------+------------------------------------------------------|
|
|
|
|
| tlp | () |
|
2023-12-01 14:30:07 +00:00
|
|
|
| thermald | ((adaptive? #t)) |
|
2023-12-01 13:22:33 +00:00
|
|
|
| bluetooth | () |
|
|
|
|
| earlyoom | ((minimum-available-memory 5) (minimum-free-swap 5)) |
|
|
|
|
| inputattach | () |
|
|
|
|
| libvirt | ((unix-sock-group "libvirt")) |
|
|
|
|
| fstrim | () |
|
|
|
|
| fprintd | () |
|
|
|
|
|
|
|
|
#+NAME: root-simple-service-block
|
|
|
|
#+begin_src scheme :noweb yes :exports none :results code
|
|
|
|
<<service-converter(input=root-simple-services)>>
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
*** Greeter Service
|
|
|
|
|
|
|
|
=greetd= is a broken mess, yet here we are.
|
|
|
|
|
|
|
|
#+NAME: greeter-service
|
|
|
|
#+begin_src scheme
|
|
|
|
(service greetd-service-type
|
|
|
|
(greetd-configuration
|
|
|
|
(greeter-supplementary-groups
|
|
|
|
(list "video" "input"))
|
|
|
|
(terminals
|
|
|
|
(list
|
|
|
|
(greetd-terminal-configuration
|
2023-12-01 15:19:17 +00:00
|
|
|
(terminal-vt "1"))
|
|
|
|
(greetd-terminal-configuration
|
|
|
|
(terminal-vt "2"))
|
|
|
|
(greetd-terminal-configuration
|
|
|
|
(terminal-vt "3"))
|
|
|
|
(greetd-terminal-configuration
|
|
|
|
(terminal-vt "4"))
|
|
|
|
#;(greetd-terminal-configuration
|
2023-12-01 15:47:03 +00:00
|
|
|
(terminal-vt "7")
|
|
|
|
(terminal-switch #t)
|
|
|
|
(default-session-command
|
|
|
|
(greetd-wlgreet-session
|
|
|
|
(command
|
2023-12-01 15:19:17 +00:00
|
|
|
(file-append swayfx "/bin/sway")))))
|
2023-12-01 13:22:33 +00:00
|
|
|
(greetd-terminal-configuration
|
|
|
|
(terminal-vt "8"))))))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
*** Screen Locker Service
|
|
|
|
|
|
|
|
For some reason, this service runs on root level for Guix.
|
|
|
|
|
|
|
|
#+NAME: screen-lock-service
|
|
|
|
#+begin_src scheme
|
|
|
|
(service screen-locker-service-type
|
|
|
|
(screen-locker-configuration
|
|
|
|
(name "swaylock")
|
|
|
|
(program
|
|
|
|
(file-append swaylock-effects "/bin/swaylock"))
|
|
|
|
(using-setuid? #f)))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Operating System
|
|
|
|
|
|
|
|
This is the full operating system specification.
|
|
|
|
|
|
|
|
#+begin_src scheme :noweb no-export :results code :tangle config.scm
|
|
|
|
(operating-system
|
|
|
|
(host-name "ziltis-machine")
|
|
|
|
(timezone "Europe/Berlin")
|
|
|
|
(locale "de_DE.utf8")
|
|
|
|
(keyboard-layout
|
|
|
|
(keyboard-layout "de" #:options '("caps:swapescape")))
|
|
|
|
(bootloader
|
|
|
|
(bootloader-configuration
|
2023-12-01 13:34:54 +00:00
|
|
|
(bootloader grub-efi-bootloader)
|
2023-12-01 13:22:33 +00:00
|
|
|
(targets
|
|
|
|
'("/boot/efi"))
|
|
|
|
(keyboard-layout keyboard-layout)))
|
|
|
|
(file-systems %local-filesystem)
|
|
|
|
(swap-devices %local-swap)
|
|
|
|
(users
|
|
|
|
(cons*
|
|
|
|
(user-account
|
|
|
|
(name "zilti")
|
|
|
|
(group "users")
|
|
|
|
(supplementary-groups
|
|
|
|
'("wheel" "netdev" "audio" "video" "libvirt")))
|
|
|
|
%base-user-accounts))
|
|
|
|
<<root-package-block>>
|
|
|
|
<<root-services-block>>
|
|
|
|
(name-service-switch %mdns-host-lookup-nss))
|
|
|
|
#+end_src
|