This commit is contained in:
Daniel Ziltener 2023-12-01 15:30:07 +01:00
parent 7c8502efe1
commit 21062014c7
Signed by: zilti
GPG key ID: B38976E82C9DAE42
3 changed files with 92 additions and 56 deletions

View file

@ -1,3 +1,4 @@
# -*- geiser-scheme-implementation: guile -*-
#+TITLE: GUIX System Configuration
#+AUTHOR: Daniel Ziltener
#+PROPERTY: header-args:scheme :comments both
@ -134,7 +135,7 @@ These services are unmodified, or have just few settings.
| Service | Options |
|-------------+------------------------------------------------------|
| tlp | () |
| thermald | ((adaptive? t)) |
| thermald | ((adaptive? #t)) |
| bluetooth | () |
| earlyoom | ((minimum-available-memory 5) (minimum-free-swap 5)) |
| inputattach | () |

View file

@ -1,21 +1,61 @@
(use-modules
(gnu)
(gnu image)
(gnu services authentication)
(gnu services base)
(gnu services dbus)
(gnu services desktop)
(gnu services linux)
(gnu services networking)
(gnu services pm)
(gnu services virtualization)
(gnu services xorg)
(gnu system nss))
;; Modules
;; #+NAME: module-list
;; - gnu
;; - gnu image
;; - gnu services authentication
;; - gnu services base
;; - gnu services dbus
;; - gnu services desktop
;; - gnu services linux
;; - gnu services networking
;; - gnu services pm
;; - gnu services virtualization
;; - gnu services xorg
;; - gnu system nss
;; [[file:config.org::*Modules][Modules:1]]
(use-modules (gnu) (gnu image) (gnu services authentication) (gnu services base) (gnu services dbus) (gnu services desktop) (gnu services linux) (gnu services networking) (gnu services pm) (gnu services virtualization) (gnu services xorg) (gnu system nss))
;; Modules:1 ends here
;; Service Modules
;; #+NAME: service-module-list
;; - desktop
;; - xorg
;; [[file:config.org::*Service Modules][Service Modules:1]]
(use-service-modules desktop xorg)
;; Service Modules:1 ends here
;; Package Modules
;; #+NAME: package-module-list
;; - bootloaders
;; - certs
;; - emacs
;; - emacs-xyz
;; - fonts
;; - readline
;; - terminals
;; - version-control
;; - wm
;; - xorg
;; [[file:config.org::*Package Modules][Package Modules:1]]
(use-package-modules bootloaders certs emacs emacs-xyz fonts readline terminals version-control wm xorg)
;; Package Modules:1 ends here
;; File System
;; The variable ~%local-filesystem~ extracts the file system definitions from the installer-provided
;; =config.scm= file.
;; [[file:config.org::*File System][File System:1]]
(define %local-filesystem
(call-with-input-file "/etc/config.scm"
(lambda (port)
@ -23,7 +63,14 @@
(read port)
(eval (cadar (last-pair (read port)))
(interaction-environment)))))
;; File System:1 ends here
;; As a sibling to the former, the variable ~%local-swap~ does the same with the swap partition.
;; [[file:config.org::*File System][File System:2]]
(define %local-swap
(call-with-input-file "/etc/config.scm"
(lambda (port)
@ -36,7 +83,14 @@
(list-ref os-list
(- os-list-length 2)))
(interaction-environment))))))
;; File System:2 ends here
;; Operating System
;; This is the full operating system specification.
;; [[file:config.org::*Operating System][Operating System:1]]
(operating-system
(host-name "ziltis-machine")
(timezone "Europe/Berlin")
@ -62,7 +116,6 @@
(packages
(append
(list emacs emacs-desktop-environment font-terminus git nss-certs readline swayfx)
%base-packages))
(services
(append
@ -71,28 +124,7 @@
(delete login-service-type)
(delete mingetty-service-type)
(delete console-font-service-type))
(list
(service tlp-service-type
(tlp-configuration))
(service thermald-service-type
(thermald-configuration
(adaptive? t)))
(service bluetooth-service-type
(bluetooth-configuration))
(service earlyoom-service-type
(earlyoom-configuration
(minimum-available-memory 5)
(minimum-free-swap 5)))
(service inputattach-service-type
(inputattach-configuration))
(service libvirt-service-type
(libvirt-configuration
(unix-sock-group "libvirt")))
(service fstrim-service-type
(fstrim-configuration))
(service fprintd-service-type
(fprintd-configuration)))
(list (service tlp-service-type (tlp-configuration)) (service thermald-service-type (thermald-configuration (adaptive? #t))) (service bluetooth-service-type (bluetooth-configuration)) (service earlyoom-service-type (earlyoom-configuration (minimum-available-memory 5) (minimum-free-swap 5))) (service inputattach-service-type (inputattach-configuration)) (service libvirt-service-type (libvirt-configuration (unix-sock-group "libvirt"))) (service fstrim-service-type (fstrim-configuration)) (service fprintd-service-type (fprintd-configuration)))
(list
(service greetd-service-type
(greetd-configuration
@ -118,3 +150,4 @@
(using-setuid? #f))))
))
(name-service-switch %mdns-host-lookup-nss))
;; Operating System:1 ends here

View file

@ -1,3 +1,4 @@
# -*- geiser-scheme-implementation: guile -*-
#+TITLE: Babel Library
This library contains code blocks to be used by other files in this repository.
@ -7,14 +8,14 @@ This library contains code blocks to be used by other files in this repository.
Converting org lists into guix ~use-~ calls.
#+NAME: list-to-use
#+begin_src emacs-lisp :var use-call="use-modules" :var entries='() :var all-parens=0 :results code pp
`(,(make-symbol use-call)
,@(mapcar (lambda (x)
(let ((splits (split-string x)))
(if (and (length= splits 1)
#+begin_src scheme :var use-call="use-modules" :var entries='() :var all-parens=0 :results code pp
`(,(string->symbol use-call)
,@(map (lambda (x)
(let ((splits (string-split x #\ )))
(if (and (= (length splits) 1)
(= 0 all-parens))
(make-symbol (car splits))
(mapcar (lambda (y) (make-symbol y))
(string->symbol (car splits))
(map (lambda (y) (string->symbol y))
splits))))
entries))
#+end_src
@ -22,22 +23,23 @@ Converting org lists into guix ~use-~ calls.
Converting Org lists into Scheme symbol lists.
#+NAME: org-to-scheme-sym-list
#+begin_src emacs-lisp :var input='() :results code pp
#+begin_src scheme :var input='() :results code pp
`(list
,@(mapcar (lambda (x) (make-symbol x)) input))
,@(map (lambda (x) (string->symbol x)) input))
#+end_src
* Converting Tables
#+NAME: service-converter
#+begin_src emacs-lisp :var input='() :colnames yes :results code pp
#+begin_src scheme :var input='() :colnames yes :results code pp
`(list
,@(mapcar
,@(map
(lambda (row)
(let ((service-name (cl-first row))
(configuration (cl-second row)))
`(service ,(make-symbol (s-concat service-name "-service-type"))
(,(make-symbol (s-concat service-name "-configuration"))
,@(car (read-from-string configuration))))))
(let ((service-name (car row))
(configuration (cadr row)))
`(service ,(string->symbol (string-append service-name "-service-type"))
(,(string->symbol (string-append service-name "-configuration"))
,@(call-with-input-string configuration
read)))))
input))
#+end_src