summaryrefslogtreecommitdiffstats
path: root/guix/jd/utils.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/jd/utils.scm')
-rw-r--r--guix/jd/utils.scm43
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