diff options
| author | jdlugosz963 <jdlugosz963@gmail.com> | 2024-09-20 15:49:53 +0200 |
|---|---|---|
| committer | jdlugosz963 <jdlugosz963@gmail.com> | 2024-09-20 16:35:16 +0200 |
| commit | c7c66c55061df867c7af05c6c82ccbe6f498c330 (patch) | |
| tree | 8b62323d26cb3db7912bc604a0b43f921660b627 /guix/jd/utils.scm | |
| parent | 41209e53c1a79947908e88e5f46b3569db4e93e2 (diff) | |
| download | dotfiles-c7c66c55061df867c7af05c6c82ccbe6f498c330.tar.gz dotfiles-c7c66c55061df867c7af05c6c82ccbe6f498c330.zip | |
Change the way i reconfigure my system.
Diffstat (limited to 'guix/jd/utils.scm')
| -rw-r--r-- | guix/jd/utils.scm | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/guix/jd/utils.scm b/guix/jd/utils.scm index f4a35c1..72be6fc 100644 --- a/guix/jd/utils.scm +++ b/guix/jd/utils.scm | |||
| @@ -1,5 +1,46 @@ | |||
| 1 | (define-module (jd utils) | 1 | (define-module (jd utils) |
| 2 | #:export (jd-search-patches)) | 2 | #:use-module (gnu system) |
| 3 | #:use-module (ice-9 match) | ||
| 4 | #:export (jd-search-patches | ||
| 5 | current-operating-system | ||
| 6 | current-home)) | ||
| 7 | |||
| 8 | (define primitive-host-operating-system | ||
| 9 | "/etc/config.scm") | ||
| 10 | |||
| 11 | (define-macro (define-combine-operating-systems name fields) | ||
| 12 | `(define (,name os-to-inherit-from os) | ||
| 13 | (operating-system | ||
| 14 | (inherit os-to-inherit-from) | ||
| 15 | ,@(map (lambda (field) | ||
| 16 | `(,field | ||
| 17 | (,(string->symbol | ||
| 18 | (string-append | ||
| 19 | "operating-system-" | ||
| 20 | (symbol->string field))) | ||
| 21 | os))) | ||
| 22 | fields)))) | ||
| 23 | |||
| 24 | (define-combine-operating-systems combine-install-dest-informations | ||
| 25 | (bootloader mapped-devices file-systems)) | ||
| 26 | |||
| 27 | (define (make-reconfigureable-os os) | ||
| 28 | (combine-install-dest-informations | ||
| 29 | os | ||
| 30 | (load primitive-host-operating-system))) | ||
| 31 | |||
| 32 | (define (current-operating-system) | ||
| 33 | (make-reconfigureable-os | ||
| 34 | (module-ref | ||
| 35 | (resolve-module | ||
| 36 | `(jd desktops ,(string->symbol (gethostname)))) | ||
| 37 | 'system))) | ||
| 38 | |||
| 39 | (define (current-home) | ||
| 40 | (module-ref | ||
| 41 | (resolve-module | ||
| 42 | `(jd desktops ,(string->symbol (gethostname)))) | ||
| 43 | 'home)) | ||
| 3 | 44 | ||
| 4 | ;; This code is copied and modified from (gnu packages) module. | 45 | ;; This code is copied and modified from (gnu packages) module. |
| 5 | 46 | ||
