diff options
-rw-r--r-- | home-config/home-configuration.scm | 6 | ||||
-rw-r--r-- | modules/ryan-config/utils.scm | 33 |
2 files changed, 38 insertions, 1 deletions
diff --git a/home-config/home-configuration.scm b/home-config/home-configuration.scm index 7f43d09..def0bf6 100644 --- a/home-config/home-configuration.scm +++ b/home-config/home-configuration.scm | |||
@@ -18,6 +18,7 @@ | |||
18 | (gnu home services) | 18 | (gnu home services) |
19 | (ryan-services pipewire) | 19 | (ryan-services pipewire) |
20 | (ryan-services spotify) | 20 | (ryan-services spotify) |
21 | (ryan-config utils) | ||
21 | (ryan-packages freedesktop) | 22 | (ryan-packages freedesktop) |
22 | (ryan-packages mozilla)) | 23 | (ryan-packages mozilla)) |
23 | 24 | ||
@@ -132,7 +133,6 @@ | |||
132 | ("sway" ,(local-file "sway" #:recursive? #t)) | 133 | ("sway" ,(local-file "sway" #:recursive? #t)) |
133 | ("hypr" ,(local-file "hypr" #:recursive? #t)) | 134 | ("hypr" ,(local-file "hypr" #:recursive? #t)) |
134 | ("foot" ,(local-file "foot" #:recursive? #t)) | 135 | ("foot" ,(local-file "foot" #:recursive? #t)) |
135 | ("spotify-player" ,(local-file "spotify-player" #:recursive? #t)) | ||
136 | ("pulse/client.conf" ,(local-file "pulseaudio/client.conf")) | 136 | ("pulse/client.conf" ,(local-file "pulseaudio/client.conf")) |
137 | ("waybar" ,(local-file "waybar" #:recursive? #t)) | 137 | ("waybar" ,(local-file "waybar" #:recursive? #t)) |
138 | ("alacritty" ,(local-file "alacritty" #:recursive? #t)) | 138 | ("alacritty" ,(local-file "alacritty" #:recursive? #t)) |
@@ -149,6 +149,10 @@ | |||
149 | (service home-pipewire-service-type) | 149 | (service home-pipewire-service-type) |
150 | (service home-spotifyd-service-type) | 150 | (service home-spotifyd-service-type) |
151 | (service home-dbus-service-type) | 151 | (service home-dbus-service-type) |
152 | ;;; trying some changes | ||
153 | (template-files "." | ||
154 | '("spotify-player/app.toml" | ||
155 | ;;; | ||
152 | (service home-gpg-agent-service-type | 156 | (service home-gpg-agent-service-type |
153 | (home-gpg-agent-configuration | 157 | (home-gpg-agent-configuration |
154 | (pinentry-program | 158 | (pinentry-program |
diff --git a/modules/ryan-config/utils.scm b/modules/ryan-config/utils.scm new file mode 100644 index 0000000..e889e69 --- /dev/null +++ b/modules/ryan-config/utils.scm | |||
@@ -0,0 +1,33 @@ | |||
1 | (define-module (ryan-config utils) | ||
2 | #:use-module (gnu packages) | ||
3 | #:use-module (gnu services) | ||
4 | #:use-module (gnu home services) | ||
5 | #:use-module (gnu home services shepherd) | ||
6 | #:use-module (gnu packages freedesktop) | ||
7 | #:use-module (gnu services configuration) | ||
8 | #:use-module (guix gexp) | ||
9 | #:use-module (ice-9 regex) | ||
10 | #:use-module (ice-9 pretty-print) | ||
11 | #:use-module (ice-9 textual-ports) | ||
12 | |||
13 | #:export (gather-manifest-packages | ||
14 | apply-template-file)) | ||
15 | |||
16 | (define (apply-template template-string value-alist) | ||
17 | (regexp-substitute/global #f | ||
18 | "\\$\\{([A-Za-z/\\-]+)\\}" | ||
19 | template-string | ||
20 | 'pre | ||
21 | (lambda (m) | ||
22 | (let ((entry (assq (string->symbol (match:substring m 1)) | ||
23 | value-alist))) | ||
24 | (if entry | ||
25 | (cdr entry) | ||
26 | "VALUE NOT FOUND"))) | ||
27 | 'post)) | ||
28 | |||
29 | (define (apply-template-file file-path value-alist) | ||
30 | (call-with-input-file file-path | ||
31 | (lambda (port) | ||
32 | (apply-template (get-string-all port) | ||
33 | value-alist)))) | ||