From c7c66c55061df867c7af05c6c82ccbe6f498c330 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Fri, 20 Sep 2024 15:49:53 +0200 Subject: Change the way i reconfigure my system. --- guix/jd/desktops/berserker.scm | 36 ++++------------------------------- guix/jd/desktops/mimir.scm | 28 +++------------------------ guix/jd/utils.scm | 43 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 58 deletions(-) (limited to 'guix/jd') 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 @@ (define-module (jd desktops berserker) #:use-module (jd desktops base) #:use-module (jd packages linux) + #:use-module (jd utils) #:use-module (gnu) #:use-module (gnu home)) -(define home +(define-public home (home-environment (services %jd-base-home-services))) -(define system +(define-public system (operating-system (inherit odin-non-free) (kernel-loadable-modules (list xmm7360-pci)) - (host-name "berserker") + (host-name "berserker"))) - - (bootloader (bootloader-configuration - (bootloader grub-efi-bootloader) - (targets (list "/boot/efi")))) - (mapped-devices (list (mapped-device - (source (uuid - "1f2b1bf2-89fe-4e2c-8b40-c460572bb776")) - (target "crypthome") - (type luks-device-mapping)))) - - (file-systems (cons* (file-system - (mount-point "/") - (device (uuid - "66396ba1-bda9-46bd-ab26-5edc46b437d6" - 'ext4)) - (type "ext4")) - (file-system - (mount-point "/boot/efi") - (device (uuid "482A-B117" - 'fat32)) - (type "vfat")) - (file-system - (mount-point "/home") - (device "/dev/mapper/crypthome") - (type "ext4") - (dependencies mapped-devices)) %base-file-systems)))) - - -(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 @@ #:use-module (gnu) #:use-module (gnu home)) -(define home +(define-public home (home-environment (services %jd-base-home-services))) -(define system +(define-public system (operating-system (inherit odin-non-free) - (host-name "mimir") - - (bootloader (bootloader-configuration - (bootloader grub-efi-bootloader) - (targets (list "/boot/efi")))) - - (swap-devices (list (swap-space - (target (uuid - "5402ec34-85b8-4716-9c37-3d38c452ef98"))))) - - (file-systems (cons* (file-system - (mount-point "/boot/efi") - (device (uuid "1A88-DB36" - 'fat32)) - (type "vfat")) - (file-system - (mount-point "/") - (device (uuid - "640c44ea-125f-4410-a8de-3ec0fb3656c4" - 'ext4)) - (type "ext4")) %base-file-systems)))) - -(if (getenv "JD_HOME") home system) + (host-name "mimir"))) 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 @@ (define-module (jd utils) - #:export (jd-search-patches)) + #:use-module (gnu system) + #:use-module (ice-9 match) + #:export (jd-search-patches + current-operating-system + current-home)) + +(define primitive-host-operating-system + "/etc/config.scm") + +(define-macro (define-combine-operating-systems name fields) + `(define (,name os-to-inherit-from os) + (operating-system + (inherit os-to-inherit-from) + ,@(map (lambda (field) + `(,field + (,(string->symbol + (string-append + "operating-system-" + (symbol->string field))) + os))) + fields)))) + +(define-combine-operating-systems combine-install-dest-informations + (bootloader mapped-devices file-systems)) + +(define (make-reconfigureable-os os) + (combine-install-dest-informations + os + (load primitive-host-operating-system))) + +(define (current-operating-system) + (make-reconfigureable-os + (module-ref + (resolve-module + `(jd desktops ,(string->symbol (gethostname)))) + 'system))) + +(define (current-home) + (module-ref + (resolve-module + `(jd desktops ,(string->symbol (gethostname)))) + 'home)) ;; This code is copied and modified from (gnu packages) module. -- cgit v1.2.3