From af77ce5cb66dd54b4bc53b3ef0e32bef8e487d85 Mon Sep 17 00:00:00 2001 From: anemofilia Date: Sun, 6 Aug 2023 16:20:09 -0300 Subject: [PATCH] refactor: remove doas and thinkfan configuration files from the system definition --- buer.scm | 70 +++++------------------------------------- files/fish/config.fish | 2 +- 2 files changed, 8 insertions(+), 64 deletions(-) diff --git a/buer.scm b/buer.scm index 5fc5c11..8c76e45 100644 --- a/buer.scm +++ b/buer.scm @@ -11,7 +11,9 @@ (radix services linux) (radix system setuid) (radix secrets) - (radix utils)) + (radix utils) + ((radix files doas) #:prefix file:doas-) + ((radix files thinkfan) #:prefix file:thinkfan-)) (use-system-modules #|N|# nss) @@ -37,68 +39,10 @@ #|T|# texinfo text-editors tmux #|V|# vpn) -(define* (permit #:key (persist #f) - (keepenv #f) - (nopass #f) - (group "wheel") - (commands '(""))) - (format #f "~{~a~%~}" - (map (lambda (command) - (match (string-split command #\space) - ((command . args) - (format #f - "permit ~:[~;persist ~]~ - ~:[~;keepenv ~]~ - ~:[~;nopass ~]:~a~:[ cmd ~a args~{ ~a~}~;~]" - persist keepenv nopass group (string-null? command) command args)))) - commands))) - #|Mcron jobs|# (define garbage-collector-job #~(job "5 0 * * *" "guix gc --optimize -F 5G")) -#|Kernel modules configuration|# -(define modprobe-thinkfan-config - (plain-file "thinkfan.conf" - "options thinkpad_acpi experimental=1 fan_control=1")) - -#|etc files|# -(define thinkfan-config - (plain-file "thinkfan.conf" - (format #f "~@{~a~%~}" - "fans:" - "- tpacpi: /proc/acpi/ibm/fan" - - "sensors:" - " - hwmon: /sys/devices/platform/coretemp.0/hwmon" - " indices: [1,2,3]" - - "levels:" - " - [0, 0, 35]" - " - [1, 30, 40]" - " - [2, 35, 45]" - " - [3, 40, 50]" - " - [4, 45, 55]" - " - [5, 50, 60]" - " - [6, 55, 65]" - " - [7, 60, 70]" - " - [\"level full-speed\", 65, 260]"))) - -(define doas-config - (plain-file "doas.conf" - (format #f "~@{~a~%~}" - "permit setenv { GUILE_LOAD_PATH } :wheel" - (permit #:keepenv #t - #:commands '("kak" "emacsclient")) - (permit #:nopass #t - #:commands '("halt" "reboot" "guix pull" "herd status")) - (permit #:nopass #t - #:commands - (flatmap (lambda (service-name action) - (format #f "herd ~a ~a" action service-name)) - '("thinkfan" "wpa-supplicant") - '("doc" "stop" "start" "status" "restart")))))) - #|Operating system definition|# (operating-system (host-name "buer") @@ -260,16 +204,16 @@ #|Thinkfan services|# (simple-service 'thinkfan-config etc-service-type - `(("modprobe.d/thinkfan.conf" ,modprobe-thinkfan-config) - ("thinkfan.conf" ,thinkfan-config))) + `(("modprobe.d/thinkfan.conf" ,file:thinkfan-modprobe-config) + ("thinkfan.conf" ,file:thinkfan-config))) (service thinkfan-service-type (thinkfan-configuration - (config-file thinkfan-config) + (config-file file:thinkfan-config) (respawn? #f))) #|Doas config service|# (simple-service 'doas-config etc-service-type - `(("doas.conf" ,doas-config))) + `(("doas.conf" ,file:doas-config))) #|Special file services|# (service special-files-service-type diff --git a/files/fish/config.fish b/files/fish/config.fish index 125a90f..a9e06d9 120000 --- a/files/fish/config.fish +++ b/files/fish/config.fish @@ -1 +1 @@ -/gnu/store/6w8x3w0kr8gkp9kcsbyvjzdvigclay40-fish-config.fish \ No newline at end of file +/gnu/store/zbd2shsljanzqv4ikbjrgr3f98sxx71i-fish-config.fish \ No newline at end of file