From 75e8c9aaa969e41e0a7ff1276b4ec3a02515e26a Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Tue, 12 Dec 2023 10:57:23 +0100 Subject: [PATCH] . --- .dir-locals.el | 3 ++- config.org | 16 +++++++++---- config.scm | 56 +++++++++++++++++++++++++++++++++++++++---- library.org | 64 ++++++++++++++++++++++++++++++-------------------- 4 files changed, 103 insertions(+), 36 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index 743926d..f4d29db 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,3 +1,4 @@ ((nil . ((geiser-scheme-implementation . guile) - (geiser-guile-binary . ("guix" "repl")))) + ;;(geiser-guile-binary . ("guix" "repl")) + )) (org-mode . ((org-confirm-babel-evaluate . nil)))) diff --git a/config.org b/config.org index 4a1f158..1591434 100644 --- a/config.org +++ b/config.org @@ -1,7 +1,7 @@ #+TITLE: GUIX System Configuration #+AUTHOR: Daniel Ziltener #+PROPERTY: scheme-implementation guile -#+PROPERTY: header-args:scheme :comments both +#+PROPERTY: header-args:scheme :comments both :session *guile* #+begin_src emacs-lisp :results none (org-babel-lob-ingest "./library.org") @@ -53,7 +53,7 @@ This is to be run after setting up the partitions. - nongnu packages linux - nongnu system linux-initrd -#+begin_src scheme :noweb yes :exports none :results code pp :tangle config.scm +#+begin_src scheme :noweb yes :exports none :results output :tangle config.scm <> #+end_src @@ -63,10 +63,12 @@ This is to be run after setting up the partitions. - desktop - xorg -#+begin_src scheme :noweb yes :exports none :results code pp :tangle config.scm +#+begin_src scheme :noweb yes :exports none :results output :tangle config.scm <> #+end_src +#+RESULTS: + ** Package Modules #+NAME: package-module-list @@ -82,7 +84,7 @@ This is to be run after setting up the partitions. - wm - xorg -#+begin_src scheme :noweb yes :exports none :results code pp :tangle config.scm +#+begin_src scheme :noweb yes :exports none :results output :tangle config.scm <> #+end_src @@ -103,6 +105,8 @@ The variable ~%local-filesystem~ extracts the file system definitions from the i (interaction-environment))))) #+end_src +#+RESULTS: + As a sibling to the former, the variable ~%local-swap~ does the same with the swap partition. #+begin_src scheme :tangle config.scm @@ -157,6 +161,8 @@ This adds the Nonguix channel. %base-packages)) #+end_src +#+RESULTS: root-package-block + ** Services #+NAME: root-services-block @@ -189,7 +195,7 @@ These services are unmodified, or have just few settings. | fprintd | () | #+NAME: root-simple-service-block -#+begin_src scheme :noweb yes :exports none :results code +#+begin_src scheme :noweb yes :exports none :results output <> #+end_src diff --git a/config.scm b/config.scm index 8890533..3822c8f 100644 --- a/config.scm +++ b/config.scm @@ -18,7 +18,20 @@ ;; [[file:config.org::*Modules][Modules:1]] -nil +(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) + (nongnu packages linux) + (nongnu system linux-initrd)) ;; Modules:1 ends here ;; Service Modules @@ -29,7 +42,7 @@ nil ;; [[file:config.org::*Service Modules][Service Modules:1]] -nil +(use-service-modules desktop xorg) ;; Service Modules:1 ends here ;; Package Modules @@ -49,7 +62,17 @@ nil ;; [[file:config.org::*Package Modules][Package Modules:1]] -nil +(use-package-modules bootloaders + certs + emacs + emacs-xyz + fonts + pciutils + readline + terminals + version-control + wm + xorg) ;; Package Modules:1 ends here ;; File System @@ -70,6 +93,8 @@ nil +;; #+RESULTS: + ;; As a sibling to the former, the variable ~%local-swap~ does the same with the swap partition. @@ -121,7 +146,13 @@ nil %base-user-accounts)) (packages (append - nil + (list emacs + emacs-desktop-environment + font-terminus + git + hwdata + nss-certs + readline) %base-packages)) (services (append @@ -138,7 +169,22 @@ nil (authorized-keys (append (list (plain-file "non-guix.pub" "<>"))))))) - nil + (list + (service tlp-service-type) + (service thermald-service-type + (thermald-configuration + (adaptive? #t))) + (service bluetooth-service-type) + (service earlyoom-service-type + (earlyoom-configuration + (minimum-available-memory 5) + (minimum-free-swap 5))) + (service inputattach-service-type) + (service libvirt-service-type + (libvirt-configuration + (unix-sock-group "libvirt"))) + (service fstrim-service-type) + (service fprintd-service-type)) (list (service greetd-service-type (greetd-configuration diff --git a/library.org b/library.org index befdf9b..bcb197f 100644 --- a/library.org +++ b/library.org @@ -1,5 +1,5 @@ -# -*- geiser-scheme-implementation: guile -*- #+TITLE: Babel Library +#+PROPERTY: header-args:scheme: :session *guile* :prologue "(use-modules (ice-9 pretty-print))" This library contains code blocks to be used by other files in this repository. @@ -8,38 +8,52 @@ 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 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)) - (string->symbol (car splits)) - (map (lambda (y) (string->symbol y)) - splits)))) - entries)) +#+begin_src scheme :var use-call="use-modules" :var entries='() :var all-parens=0 :results output + (pretty-print + `(,(string->symbol use-call) + ,@(map (lambda (x) + (let ((splits (string-split x #\ ))) + (if (and (= (length splits) 1) + (= 0 all-parens)) + (string->symbol (car splits)) + (map (lambda (y) (string->symbol y)) + splits)))) + entries))) #+end_src Converting Org lists into Scheme symbol lists. +#+NAME: sym-list-sample +- Entry 1 +- Entry 2 + #+NAME: org-to-scheme-sym-list -#+begin_src scheme :var input='() :results code pp - `(list - ,@(map (lambda (x) (string->symbol x)) input)) +#+begin_src scheme :var input=sym-list-sample :results output + (pretty-print + `(list + ,@(map (lambda (x) (string->symbol x)) input))) #+end_src +#+RESULTS: org-to-scheme-sym-list +: ice-9/boot-9.scm:1685:16: In procedure raise-exception: +: Wrong type to apply: "Entry 1" +: +: Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. +: scheme@(guile-user) [1]> + * Converting Tables #+NAME: service-converter -#+begin_src scheme :var input='() :colnames yes :results code pp - `(list - ,@(map - (lambda (row) - (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)) +#+begin_src scheme :var input='() :colnames yes :results code + (pretty-print + `(list + ,@(map + (lambda (row) + (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