refactor: remove doas and thinkfan configuration files from the system definition

keyring
anemofilia 2023-08-06 16:20:09 -03:00
parent 4551974b12
commit af77ce5cb6
2 changed files with 8 additions and 64 deletions

View File

@ -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

View File

@ -1 +1 @@
/gnu/store/6w8x3w0kr8gkp9kcsbyvjzdvigclay40-fish-config.fish
/gnu/store/zbd2shsljanzqv4ikbjrgr3f98sxx71i-fish-config.fish