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

View File

@ -1,21 +1,61 @@
(use-modules ;; 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))
;; #+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) (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) (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 (define %local-filesystem
(call-with-input-file "/etc/config.scm" (call-with-input-file "/etc/config.scm"
(lambda (port) (lambda (port)
@ -23,7 +63,14 @@
(read port) (read port)
(eval (cadar (last-pair (read port))) (eval (cadar (last-pair (read port)))
(interaction-environment))))) (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 (define %local-swap
(call-with-input-file "/etc/config.scm" (call-with-input-file "/etc/config.scm"
(lambda (port) (lambda (port)
@ -36,7 +83,14 @@
(list-ref os-list (list-ref os-list
(- os-list-length 2))) (- os-list-length 2)))
(interaction-environment)))))) (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 (operating-system
(host-name "ziltis-machine") (host-name "ziltis-machine")
(timezone "Europe/Berlin") (timezone "Europe/Berlin")
@ -62,7 +116,6 @@
(packages (packages
(append (append
(list emacs emacs-desktop-environment font-terminus git nss-certs readline swayfx) (list emacs emacs-desktop-environment font-terminus git nss-certs readline swayfx)
%base-packages)) %base-packages))
(services (services
(append (append
@ -71,28 +124,7 @@
(delete login-service-type) (delete login-service-type)
(delete mingetty-service-type) (delete mingetty-service-type)
(delete console-font-service-type)) (delete console-font-service-type))
(list (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)))
(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 (list
(service greetd-service-type (service greetd-service-type
(greetd-configuration (greetd-configuration
@ -118,3 +150,4 @@
(using-setuid? #f)))) (using-setuid? #f))))
)) ))
(name-service-switch %mdns-host-lookup-nss)) (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 #+TITLE: Babel Library
This library contains code blocks to be used by other files in this repository. 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. Converting org lists into guix ~use-~ calls.
#+NAME: list-to-use #+NAME: list-to-use
#+begin_src emacs-lisp :var use-call="use-modules" :var entries='() :var all-parens=0 :results code pp #+begin_src scheme :var use-call="use-modules" :var entries='() :var all-parens=0 :results code pp
`(,(make-symbol use-call) `(,(string->symbol use-call)
,@(mapcar (lambda (x) ,@(map (lambda (x)
(let ((splits (split-string x))) (let ((splits (string-split x #\ )))
(if (and (length= splits 1) (if (and (= (length splits) 1)
(= 0 all-parens)) (= 0 all-parens))
(make-symbol (car splits)) (string->symbol (car splits))
(mapcar (lambda (y) (make-symbol y)) (map (lambda (y) (string->symbol y))
splits)))) splits))))
entries)) entries))
#+end_src #+end_src
@ -22,22 +23,23 @@ Converting org lists into guix ~use-~ calls.
Converting Org lists into Scheme symbol lists. Converting Org lists into Scheme symbol lists.
#+NAME: org-to-scheme-sym-list #+NAME: org-to-scheme-sym-list
#+begin_src emacs-lisp :var input='() :results code pp #+begin_src scheme :var input='() :results code pp
`(list `(list
,@(mapcar (lambda (x) (make-symbol x)) input)) ,@(map (lambda (x) (string->symbol x)) input))
#+end_src #+end_src
* Converting Tables * Converting Tables
#+NAME: service-converter #+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 `(list
,@(mapcar ,@(map
(lambda (row) (lambda (row)
(let ((service-name (cl-first row)) (let ((service-name (car row))
(configuration (cl-second row))) (configuration (cadr row)))
`(service ,(make-symbol (s-concat service-name "-service-type")) `(service ,(string->symbol (string-append service-name "-service-type"))
(,(make-symbol (s-concat service-name "-configuration")) (,(string->symbol (string-append service-name "-configuration"))
,@(car (read-from-string configuration)))))) ,@(call-with-input-string configuration
read)))))
input)) input))
#+end_src #+end_src