diff options
author | Kenny Ballou <kb@devnulllabs.io> | 2023-12-05 09:57:03 -0700 |
---|---|---|
committer | Kenny Ballou <kb@devnulllabs.io> | 2023-12-05 09:58:58 -0700 |
commit | 93dd91a285a717e2323a4694a62c0df9f8f0047b (patch) | |
tree | afeb26a80a34b6bba2b300e378d4ad98e9c205b9 /kbg | |
parent | 3fca428cb3a6749e44d5301b4b0ceecabf15b2c2 (diff) | |
download | dotfiles-93dd91a285a717e2323a4694a62c0df9f8f0047b.tar.gz dotfiles-93dd91a285a717e2323a4694a62c0df9f8f0047b.tar.xz |
config: ssh: concatenate hosts and base config
Concatenate all SSH configuration into a single file, symlinked to the
usual place.
Arbitrary scheme code seems wrong, but this does exactly what we want at
build time.
Signed-off-by: Kenny Ballou <kb@devnulllabs.io>
Diffstat (limited to 'kbg')
-rw-r--r-- | kbg/services/config/ssh.scm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/kbg/services/config/ssh.scm b/kbg/services/config/ssh.scm index af6e2212..e2902ce5 100644 --- a/kbg/services/config/ssh.scm +++ b/kbg/services/config/ssh.scm @@ -4,17 +4,29 @@ #:use-module (guix) #:use-module (gnu home services) #:use-module (kbg packages networking) + #:use-module (ice-9 ftw) + #:use-module (ice-9 textual-ports) #:export (ssh-config-service)) +(define (read-to-string file) + (call-with-input-file file get-string-all)) + +(define ssh-config-files + (map (lambda (f) (string-append %dotfiles-root "config/ssh/ssh/config.d/" f)) + (scandir (string-append %dotfiles-root "config/ssh/ssh/config.d") + (lambda (f) (string-contains f ".conf"))))) + (define ssh-config-service (list (simple-service 'ssh-config home-files-service-type `((".ssh/isup" ,(file-append isup "/bin/isup")) (".ssh/config" - ,(local-file (string-append %dotfiles-root "config/ssh/ssh/config"))) + ,(plain-file "kb-ssh-config" + (string-join (append (map read-to-string ssh-config-files) + (list (read-to-string (string-append + %dotfiles-root + "config/ssh/ssh/config")))) + "\n"))) (".ssh/authorized_keys" - ,(local-file (string-append %dotfiles-root "config/ssh/ssh/authorized_keys"))) - (".ssh/config.d" - ,(local-file (string-append %dotfiles-root "config/ssh/ssh/config.d") - #:recursive? #t)))))) + ,(local-file (string-append %dotfiles-root "config/ssh/ssh/authorized_keys"))))))) |