summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2024-09-20 15:49:53 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2024-09-20 16:35:16 +0200
commitc7c66c55061df867c7af05c6c82ccbe6f498c330 (patch)
tree8b62323d26cb3db7912bc604a0b43f921660b627
parent41209e53c1a79947908e88e5f46b3569db4e93e2 (diff)
downloaddotfiles-c7c66c55061df867c7af05c6c82ccbe6f498c330.tar.gz
dotfiles-c7c66c55061df867c7af05c6c82ccbe6f498c330.zip
Change the way i reconfigure my system.
-rwxr-xr-xfiles/.bin/home-reconfigure8
-rwxr-xr-xfiles/.bin/system-reconfigure9
-rwxr-xr-xguix/jd/desktops/berserker.scm36
-rw-r--r--guix/jd/desktops/mimir.scm28
-rw-r--r--guix/jd/utils.scm43
5 files changed, 64 insertions, 60 deletions
diff --git a/files/.bin/home-reconfigure b/files/.bin/home-reconfigure
index f3a4e5f..4d16cc0 100755
--- a/files/.bin/home-reconfigure
+++ b/files/.bin/home-reconfigure
@@ -1,3 +1,9 @@
1#!/bin/sh 1#!/bin/sh
2 2
3JD_HOME=1 guix home -L $HOME/dotfiles/guix reconfigure $HOME/dotfiles/guix/jd/desktops/$(hostname).scm 3if [ -n "$1" ]; then
4 guix home -L $1 reconfigure \
5 -e '((@@ (jd utils) current-home))'
6else
7 guix home reconfigure \
8 -e '((@@ (jd utils) current-home))'
9fi;
diff --git a/files/.bin/system-reconfigure b/files/.bin/system-reconfigure
index c4c1a05..dae18f6 100755
--- a/files/.bin/system-reconfigure
+++ b/files/.bin/system-reconfigure
@@ -1,3 +1,10 @@
1#!/bin/sh 1#!/bin/sh
2 2
3sudo -E guix system -L $HOME/dotfiles/guix reconfigure $HOME/dotfiles/guix/jd/desktops/$(hostname).scm \ No newline at end of file 3if [ -n "$1" ]; then
4 sudo -E guix system -L $1 reconfigure \
5 -e '((@@ (jd utils) current-operating-system))'
6else
7 sudo -E guix system reconfigure \
8 -e '((@@ (jd utils) current-operating-system))'
9fi;
10
diff --git a/guix/jd/desktops/berserker.scm b/guix/jd/desktops/berserker.scm
index 37e7adc..3d6b0df 100755
--- a/guix/jd/desktops/berserker.scm
+++ b/guix/jd/desktops/berserker.scm
@@ -1,45 +1,17 @@
1(define-module (jd desktops berserker) 1(define-module (jd desktops berserker)
2 #:use-module (jd desktops base) 2 #:use-module (jd desktops base)
3 #:use-module (jd packages linux) 3 #:use-module (jd packages linux)
4 #:use-module (jd utils)
4 #:use-module (gnu) 5 #:use-module (gnu)
5 #:use-module (gnu home)) 6 #:use-module (gnu home))
6 7
7(define home 8(define-public home
8 (home-environment 9 (home-environment
9 (services %jd-base-home-services))) 10 (services %jd-base-home-services)))
10 11
11(define system 12(define-public system
12 (operating-system 13 (operating-system
13 (inherit odin-non-free) 14 (inherit odin-non-free)
14 (kernel-loadable-modules (list xmm7360-pci)) 15 (kernel-loadable-modules (list xmm7360-pci))
15 (host-name "berserker") 16 (host-name "berserker")))
16 17
17
18 (bootloader (bootloader-configuration
19 (bootloader grub-efi-bootloader)
20 (targets (list "/boot/efi"))))
21 (mapped-devices (list (mapped-device
22 (source (uuid
23 "1f2b1bf2-89fe-4e2c-8b40-c460572bb776"))
24 (target "crypthome")
25 (type luks-device-mapping))))
26
27 (file-systems (cons* (file-system
28 (mount-point "/")
29 (device (uuid
30 "66396ba1-bda9-46bd-ab26-5edc46b437d6"
31 'ext4))
32 (type "ext4"))
33 (file-system
34 (mount-point "/boot/efi")
35 (device (uuid "482A-B117"
36 'fat32))
37 (type "vfat"))
38 (file-system
39 (mount-point "/home")
40 (device "/dev/mapper/crypthome")
41 (type "ext4")
42 (dependencies mapped-devices)) %base-file-systems))))
43
44
45(if (getenv "JD_HOME") home system)
diff --git a/guix/jd/desktops/mimir.scm b/guix/jd/desktops/mimir.scm
index 7d9823d..e5db0b7 100644
--- a/guix/jd/desktops/mimir.scm
+++ b/guix/jd/desktops/mimir.scm
@@ -3,34 +3,12 @@
3 #:use-module (gnu) 3 #:use-module (gnu)
4 #:use-module (gnu home)) 4 #:use-module (gnu home))
5 5
6(define home 6(define-public home
7 (home-environment 7 (home-environment
8 (services %jd-base-home-services))) 8 (services %jd-base-home-services)))
9 9
10(define system 10(define-public system
11 (operating-system 11 (operating-system
12 (inherit odin-non-free) 12 (inherit odin-non-free)
13 (host-name "mimir") 13 (host-name "mimir")))
14
15 (bootloader (bootloader-configuration
16 (bootloader grub-efi-bootloader)
17 (targets (list "/boot/efi"))))
18
19 (swap-devices (list (swap-space
20 (target (uuid
21 "5402ec34-85b8-4716-9c37-3d38c452ef98")))))
22
23 (file-systems (cons* (file-system
24 (mount-point "/boot/efi")
25 (device (uuid "1A88-DB36"
26 'fat32))
27 (type "vfat"))
28 (file-system
29 (mount-point "/")
30 (device (uuid
31 "640c44ea-125f-4410-a8de-3ec0fb3656c4"
32 'ext4))
33 (type "ext4")) %base-file-systems))))
34
35(if (getenv "JD_HOME") home system)
36 14
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