grokking simplicity and refactoring
This commit is contained in:
parent
89a7fe100d
commit
fb4361d938
67 changed files with 6275 additions and 56 deletions
32
packages/lab-tool/config/config.scm
Normal file
32
packages/lab-tool/config/config.scm
Normal file
|
@ -0,0 +1,32 @@
|
|||
;; lab/core/config.scm - Configuration functionality
|
||||
|
||||
(define-module (lab core config)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (get-all-machines
|
||||
get-machine-config
|
||||
get-ssh-config
|
||||
get-homelab-root
|
||||
option-ref))
|
||||
|
||||
(define (option-ref options key default)
|
||||
"Get option value from options alist with default"
|
||||
(let ((value (assoc-ref options key)))
|
||||
(if value value default)))
|
||||
|
||||
(define (get-all-machines)
|
||||
"Get list of all machines"
|
||||
'(grey-area sleeper-service congenital-optimist reverse-proxy))
|
||||
|
||||
(define (get-machine-config machine-name)
|
||||
"Get configuration for a machine"
|
||||
`((services . (systemd ssh))
|
||||
(type . server)))
|
||||
|
||||
(define (get-ssh-config machine-name)
|
||||
"Get SSH configuration for a machine"
|
||||
`((hostname . ,(symbol->string machine-name))
|
||||
(is-local . #f)))
|
||||
|
||||
(define (get-homelab-root)
|
||||
"Get home lab root directory"
|
||||
"/home/geir/Home-lab")
|
Loading…
Add table
Add a link
Reference in a new issue