summaryrefslogtreecommitdiffstats
path: root/guix/jd/utils.scm
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2025-08-11 17:36:57 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2025-08-11 17:40:12 +0200
commitbc591dcedf45b80f70661f33c42c68dbd581e901 (patch)
tree4a3cbd7831d8e0d8ce12f318d64e06848c9ea3ab /guix/jd/utils.scm
parent1ebb0e267b40d86386b66b7b81686461446e39f8 (diff)
downloaddotfiles-bc591dcedf45b80f70661f33c42c68dbd581e901.tar.gz
dotfiles-bc591dcedf45b80f70661f33c42c68dbd581e901.zip
Migrate to RDEHEADmaster
Diffstat (limited to 'guix/jd/utils.scm')
-rw-r--r--guix/jd/utils.scm75
1 files changed, 0 insertions, 75 deletions
diff --git a/guix/jd/utils.scm b/guix/jd/utils.scm
deleted file mode 100644
index 72be6fc..0000000
--- a/guix/jd/utils.scm
+++ /dev/null
@@ -1,75 +0,0 @@
1(define-module (jd utils)
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))
44
45;; This code is copied and modified from (gnu packages) module.
46
47(define (make-custom-load-path dir-path)
48 (make-parameter
49 (map (lambda (directory)
50 (let ((custom-dir (string-append directory dir-path)))
51 (if (and (file-exists? custom-dir)
52 (file-is-directory? custom-dir))
53 custom-dir
54 directory)))
55 %load-path)))
56
57(define (make-custom-searcher load-path)
58 (lambda (file-name)
59 (or (search-path (load-path) file-name)
60 (raise (string-append file-name
61 ": not found")))))
62
63(define %jd-patch-path (make-custom-load-path "/jd/packages/patches"))
64(define %jd-dot-files-path (make-custom-load-path "/jd/home/services/dotfiles"))
65
66(define (jd-search-patch file-name)
67 "Search the patch FILE-NAME. Raise an error if not found."
68 (or (search-path (%jd-patch-path) file-name)
69 (raise (string-append file-name
70 ": patch not found"))))
71
72(define-syntax-rule (jd-search-patches file-name ...)
73 "Return the list of absolute file names corresponding to each
74FILE-NAME found in %JD-PATCH-PATH."
75 (list (jd-search-patch file-name) ...))