summaryrefslogtreecommitdiff
path: root/systems/mcdowell-old.scm
blob: f915087f346613e4027dc9bc47e5f98df5cdfe49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
(define-module (systems mcdowell-old)
  #:use-module (users id1000))

(define host-name*
  "mcdowell")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define install-grub-mcdowell
  ((@ (guix gexp) gexp)
   (lambda (bootloader device mount-point)
     (let ((grub (string-append bootloader "/sbin/grub-install"))
           (install-dir (string-append mount-point "/boot")))
       ;; Install GRUB on DEVICE which is mounted at MOUNT-POINT. If DEVICE
       ;; is #f, then we populate the disk-image rooted at MOUNT-POINT.
       (if device
           (begin
             ;; Tell 'grub-install' that there might be a LUKS-encrypted
             ;; /boot or root partition.
             (setenv "GRUB_ENABLE_CRYPTODISK" "y")

             ;; Hide potentially confusing messages from the user, such as
             ;; "Installing for i386-pc platform."
             (invoke/quiet grub
                           "--no-floppy"
                           "--target=x86_64-efi"
                           "--removable"
                           "--no-nvram"
                           "--boot-directory"
                           install-dir
                           "--efi-directory"
                           "/boot/efi")

             ;; (invoke/quiet grub
             ;;               "--no-floppy"
             ;;               "--target=i386-efi"
             ;;               "--removable"
             ;;               "--no-nvram"
             ;;               "--boot-directory"
             ;;               install-dir
             ;;               "--efi-directory"
             ;;               "/boot/efi")

             (invoke/quiet grub "--no-floppy" "--target=i386-pc"
                           "--boot-directory" install-dir
                           device))
           ;; When creating a disk-image, only install a font and GRUB modules.
           (let* ((fonts (string-append install-dir "/grub/fonts")))
             (mkdir-p fonts)
             (copy-file (string-append bootloader "/share/grub/unicode.pf2")
                        (string-append fonts "/unicode.pf2"))
             (copy-recursively (string-append bootloader "/lib/")
                               install-dir)))))))

(define home-environments-mcdowell
  `((,uid1000-name ,(uid1000-home-environment host-name*))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define bootloader-target-mcdowell
  ((@ (machines amd64) bootloader-device-path) host-name*))

(define (desktop-services-mcdowell)
  (use-modules (suweren system))
  %suweren-services)

(define grub-custom-bootloader-mcdowell
  (let
      ((grub-mkrescue-bootloader (@ (gnu bootloader grub) grub-mkrescue-bootloader)))
    ((@ (gnu bootloader) bootloader)
     (inherit grub-mkrescue-bootloader)
     (installer install-grub-mcdowell))))

(define keyboard-layout-mcdowell
  ((@ (gnu system keyboard) keyboard-layout)
   "pl"))

(define (guix-home-service-mcdowell)
  (use-modules (gnu services guix))
  ((@ (gnu services) service)
   guix-home-service-type
   home-environments-mcdowell))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define bootloader-mcdowell
  ((@ (gnu bootloader) bootloader-configuration)
   (bootloader grub-custom-bootloader-mcdowell)
   (keyboard-layout keyboard-layout-mcdowell)
   (targets (list bootloader-target-mcdowell))))

(define (label-mcdowell operating-system)
  (let*
      ((operating-system-default-label (@ (gnu system) operating-system-default-label))
       (default-label-string (operating-system-default-label operating-system)))
    (string-append host-name*
                   ": "
                   default-label-string)))

(define services-mcdowell
  (append (desktop-services-mcdowell)
          (list (guix-home-service-mcdowell))))

(define users-mcdowell
  (list uid1000-account))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define-public operating-system*
  (let
      ((%base-groups (@ (gnu system shadow) %base-groups))
       (%base-packages (@ (gnu system) %base-packages))
       (%base-initrd-modules (@ (gnu system linux-initrd) %base-initrd-modules))
       (%default-issue (@@ (gnu system) %default-issue))
       (%default-kernel-arguments (@ (gnu system) %default-kernel-arguments))
       (%default-locale-libcs (@ (gnu system locale) %default-locale-libcs))
       (%default-nss (@ (gnu system nss) %default-nss))
       (%default-privileged-programs (@ (gnu system) %default-privileged-programs))
       (%setuid-programs (@ (gnu system) %setuid-programs))
       (%sudoers-specification* (@ (suweren commons sudoers) %sudoers-specification*))
       (%suweren-locale-definitions (@ (suweren system) %suweren-locale-definitions))
       (base-pam-services ((@ (gnu system pam) base-pam-services)))
       (default-skeletons ((@ (gnu system shadow) default-skeletons)))
       (file-systems* (@ (machines amd64) file-systems*))
       (firmware* (@ (machines amd64) firmware*))
       (initrd* (@ (machines amd64) initrd*))
       (kernel-amd64 (@ (machines amd64) kernel-amd64))
       (location-mcdowell (and=> ((@ (guix utils) current-source-location))
                                 (@ (guix utils) source-properties->location)))
       (operating-system-default-essential-services (@ (gnu system) operating-system-default-essential-services))
       (polish-locale-string (@ (suweren system) polish-locale-string))
       (swap-devices* (@ (machines amd64) swap-devices*)))
    ((@ (gnu system) operating-system)
     (kernel kernel-amd64)
     (kernel-loadable-modules (list))
     (kernel-arguments %default-kernel-arguments)
     (hurd #f)
     (bootloader bootloader-mcdowell)
     (label (label-mcdowell (@ (gnu system) this-operating-system)))
     (keyboard-layout keyboard-layout-mcdowell)
     (initrd initrd*)
     (initrd-modules %base-initrd-modules)
     (firmware firmware*)
     (host-name host-name*)
     (mapped-devices (list))
     (file-systems (file-systems* host-name*))
     (swap-devices (swap-devices* host-name*))
     (users users-mcdowell)
     (groups %base-groups)
     (skeletons default-skeletons)
     (issue %default-issue)
     (packages %base-packages)
     (timezone "Europe/Warsaw")
     (locale polish-locale-string)
     (locale-definitions %suweren-locale-definitions)
     (locale-libcs %default-locale-libcs)
     (name-service-switch %default-nss)
     (essential-services (operating-system-default-essential-services (@ (gnu system) this-operating-system)))
     (services services-mcdowell)
     (pam-services base-pam-services)
     (privileged-programs %default-privileged-programs)
     (setuid-programs %setuid-programs)
     (sudoers-file %sudoers-specification*)
     (location location-mcdowell))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

operating-system*