summaryrefslogtreecommitdiff
path: root/deployment/system/asakura.scm
blob: 3a253ec1f5962e6b54aec6fa85e56631c9af6048 (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
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; SPDX-FileCopyrightText: 2026 Marek Paśnikowski <marek@marekpasnikowski.pl>

;;; COPYRIGHT NOTICE
;;;
;;; Copyright 2026, Marek Paśnikowski <marek@marekpasnikowski.pl>

;;; LICENSE NOTICE
;;;
;;; This library is free software: you can redistribute it and/or modify it under the terms of
;;; the GNU General Public License as published by the Free Software Foundation,
;;; either version 3 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
;;; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;;; See the GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License along with this library.
;;; If not, see <https://www.gnu.org/licenses/>.

(define-module (deployment system asakura)
  #:use-module ((gnu system)                    #:prefix gnu:system:)
  #:use-module ((gnu system file-systems)       #:prefix gnu:system:file-systems:)
  #:use-module ((gnu system uuid)               #:prefix gnu:system:uuid:)
  #:use-module ((nongnu packages linux)         #:prefix nongnu:packages:linux:)
  #:use-module ((nongnu system linux-initrd)    #:prefix nongnu:system:linux-initrd:)
  #:use-module ((sovereign devices amd64)       #:prefix sovereign:devices:amd64:)
  #:use-module ((sovereign packages protonmail) #:prefix sovereign:packages:protonmail:)
  #:use-module ((sovereign systems)             #:prefix sovereign:systems:)
  #:use-module ((users id1000)                  #:prefix users:id1000:))

(define efi-filesystem-uuid
  (gnu:system:uuid:uuid
   "B4FB-CBD9"
   'fat32))

(define host-name
  "asakura")

(define (label number)
  (gnu:system:file-systems:file-system-label
   (string-append host-name
                  "-swap"
                  number)))

(define root-filesystem-uuid
  (gnu:system:uuid:uuid
   "615a98cd-a632-4ee5-a6f4-e5ebcaa6fb8c"))

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

(define efi-partition
  (gnu:system:file-systems:file-system
   (mount-point "/boot")
   (device efi-filesystem-uuid)
   (type "vfat")))

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

(define (libvirt-service)
  (use-modules (gnu services virtualization))
  ((@ (gnu services) service)
   libvirt-service-type))

(define (virtlog-service)
  (use-modules (gnu services virtualization))
  ((@ (gnu services) service)
   virtlog-service-type))

(define root-partition
  (gnu:system:file-systems:file-system
   (mount-point "/")
   (device root-filesystem-uuid)
   (type "ext4")))

(define (swap-label number)
  (let ((target-label (label number)))
    (gnu:system:file-systems:swap-space
     (target target-label))))

(define (system-packages-service)
  (use-modules (gnu packages gnupg)
               (gnu packages kde-pim)
               (gnu services))
  (simple-service 'system-packages
                  profile-service-type
                  (list kgpg
                        pinentry-qt
                        pinentry-tty)))

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

(define (bootloader)
  (use-modules (gnu bootloader grub))
  ((@ (gnu bootloader) bootloader-configuration)
   (bootloader grub-efi-bootloader)
   (targets (list "/boot"))
   (keyboard-layout keyboard-layout)))

(define (file-systems)
  (append gnu:system:file-systems:%base-file-systems
          (list root-partition
                efi-partition)))

(define services
  (let*
   ( (l-guix-homes        (list users:id1000:named-home-environment))
     (l-guix-home-service (sovereign:systems:guix-home-service l-guix-homes)))
   (append sovereign:systems:%sovereign-services
          (list sovereign:packages:protonmail:nogui-profile
                l-guix-home-service
                (system-packages-service)))))

(define swap-device-1
  (swap-label "-1"))

(define swap-device-2
  (swap-label "-2"))

(define (users)
  (use-modules (gnu system accounts))
  (append (@ (gnu system shadow) %base-user-accounts)
          (list users:id1000:uid1000-account)))

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

(define-public system
  (gnu:system:operating-system
   (kernel nongnu:packages:linux:linux)
   (bootloader (bootloader))
   (label      (sovereign:systems:operating-system-label* host-name
                                                          gnu:system:this-operating-system))
   (keyboard-layout keyboard-layout)
   (initrd nongnu:system:linux-initrd:microcode-initrd)
   (firmware (list nongnu:packages:linux:linux-firmware))
   (host-name host-name)
   (file-systems (file-systems))
   (swap-devices (list swap-device-1
                       swap-device-2))
   (users (users))
   (timezone "Europe/Warsaw")
   (locale sovereign:systems:pl-locale)
   (locale-definitions sovereign:systems:%sovereign-locale-definitions)
   (services services)
   (sudoers-file sovereign:systems:%sovereign-sudoers-specification)))

(define-public operating-system* system)