aboutsummaryrefslogtreecommitdiff
path: root/systems/yak.scm
blob: 0402726642f02b8cf87a6b89a75e8daa4e3886ee (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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
(define-module (systems yak)
  #:use-module (guix)
  #:use-module (guix records)
  #:use-module (guix utils)
  #:use-module (gnu)
  #:use-module (gnu packages)
  #:use-module (gnu services avahi)
  #:use-module (gnu services base)
  #:use-module (gnu services cups)
  #:use-module (gnu services dbus)
  #:use-module (gnu services desktop)
  #:use-module (gnu services docker)
  #:use-module (gnu services linux)
  #:use-module (gnu services mcron)
  #:use-module (gnu services networking)
  #:use-module (gnu services nix)
  #:use-module (gnu services pm)
  #:use-module (gnu services security-token)
  #:use-module (gnu services ssh)
  #:use-module (gnu services xorg)
  #:use-module (gnu system nss)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages linux)
  #:use-module (nongnu packages linux)
  #:use-module (nongnu packages mozilla)
  #:use-module (nongnu packages printers)
  #:use-module (nongnu system linux-initrd)
  #:use-module (kbg)
  #:use-module (kbg packages profiles base)
  #:use-module (kbg packages profiles desktop)
  #:use-module (kbg services desktop)
  #:use-module (kbg services dict)
  #:use-module (kbg services nftables)
  #:use-module (kbg services slurm)
  #:use-module ((kbg system mcron) :prefix mcron:)
  #:use-module (kbg system xorg))

(define yak-system
  (operating-system
   (kernel linux-lts)
   (firmware (list linux-firmware))
   (initrd microcode-initrd)
   (host-name "yak")
   (timezone "America/Boise")
   (locale "en_US.utf8")

   (initrd-modules %base-initrd-modules)

   (keyboard-layout (keyboard-layout "us" #:options '("ctrl:nocaps")))

   (bootloader (bootloader-configuration
                (bootloader grub-efi-bootloader)
                (targets '("/boot/efi"))
                (keyboard-layout keyboard-layout)))

   (mapped-devices
    (list (mapped-device
           (source "vg0")
           (targets (list "vg0-root" "vg0-var" "vg0-tmp" "vg0-nix" "vg0-guix" "vg0-var" "vg0-swap"))
           (type lvm-device-mapping))
          (mapped-device
           (source "vg1")
           (targets (list "vg1-home"))
           (type lvm-device-mapping))))

   (file-systems (append
                  (list (file-system
                         (device "/dev/mapper/vg0-root")
                         (mount-point "/")
                         (type "ext4")
                         (needed-for-boot? #t)
                         (dependencies mapped-devices))
                        (file-system
                         (device "/dev/mapper/vg0-guix")
                         (mount-point "/gnu")
                         (type "xfs")
                         (needed-for-boot? #t)
                         (dependencies mapped-devices))
                        (file-system
                         (device "/dev/mapper/vg0-nix")
                         (mount-point "/nix")
                         (type "xfs")
                         (needed-for-boot? #f)
                         (dependencies mapped-devices))
                        (file-system
                         (device "/dev/mapper/vg0-var")
                         (mount-point "/var")
                         (type "ext4")
                         (needed-for-boot? #t)
                         (dependencies mapped-devices))
                        (file-system
                         (device "/dev/mapper/vg0-tmp")
                         (mount-point "/tmp")
                         (type "ext4")
                         (needed-for-boot? #t)
                         (dependencies mapped-devices))
                        (file-system
                         (device "/dev/mapper/vg0-opt")
                         (mount-point "/opt")
                         (type "ext4")
                         (needed-for-boot? #f)
                         (dependencies mapped-devices))
                        (file-system
                         (device (uuid "EAB6-6000" 'fat))
                         (mount-point "/boot/efi")
                         (type "vfat"))
                        (file-system
                         (device "/dev/mapper/vg1-home")
                         (mount-point "/home")
                         (type "xfs")
                         (needed-for-boot? #f)
                         (dependencies mapped-devices)))
                  %base-file-systems))

   (swap-devices (list (swap-space (target "/dev/mapper/vg0-swap")
                                   (dependencies mapped-devices)
                                   (discard? #t))))

   (users (cons (user-account
                 (name "kb")
                 (group "users")
                 (supplementary-groups '("input"
                                         "kvm"
                                         "netdev"
                                         "tty"
                                         "wheel")))
                %base-user-accounts))

   ;; This is where we specify system-wide packages.
   (packages (append %kbg-base-packages
                     %kbg-bare-desktop-packages
                     %base-packages))

   (services (append (list (service nix-service-type)
                           (service tlp-service-type
                                    (tlp-configuration
                                     (cpu-scaling-governor-on-ac (list "performance"))
                                     ;; (cpu-scaling-min-freq-on-ac  2400000)
                                     (cpu-boost-on-ac? #t)
                                     (energy-perf-policy-on-ac "performance")
                                     (pcie-aspm-on-ac "performance")))
                           (service openssh-service-type
                                    (openssh-configuration
                                     (x11-forwarding? #f)
                                     (password-authentication? #f)
                                     (permit-root-login 'prohibit-password)))
                           (nftables-service "yak")
                           (service singularity-service-type)
                           (service munge-service-type)
                           (service slurm-service-type
                                    (slurm-configuration
                                     (SlurmdLogFile "/var/log/slurm/slurmd.log")
                                     (SlurmctldLogFile "/var/log/slurm/slurmctld.log")
                                     (ClusterName "yaks")
                                     (SlurmUser "slurm")
                                     (SlurmctldHost '("localhost"))
                                     (DbdHost "localhost")
                                     (StorageType "accounting_storage/none")
                                     (slurm-extra-content
                                      (string-append
                                       "StateSaveLocation=/var/spool/slurmd/ctld #default /var/spool\n"
                                       "ReturnToService=1 #default 0\n"
                                       "DebugFlags=NO_CONF_HASH #default empty\n"
                                       "DefMemPerCpu=1024\n"
                                       "MaxMemPerCpu=1920\n"
                                       "# Scheduling\n"
                                       "FastSchedule=1\n"
                                       "SchedulerType=sched/backfill\n"
                                       "SelectType=select/cons_res #default select/linear\n"
                                       "SelectTypeParameters=CR_CPU_Memory #default 0\n"
                                       "# COMPUTE NODES\n"
                                       "NodeName=yak CPUs=8 RealMemory=15926 Boards=1 SocketsPerBoard=1 CoresPerSocket=4 ThreadsPerCore=2\n"
                                       "PartitionName=debug Nodes=ALL Default=YES MaxTime=INFINITE State=UP"))
                                     (cgroup-extra-content
                                      (string-append
                                       "CgroupPlugin=cgroup/v1\n"
                                       "CgroupAutomount=yes #default no\n"
                                       "ConstrainCores=yes #default no\n"
                                       "IgnoreSystemd=yes #default no\n"
                                       "MaxRAMPercent=80  #default 100"))
                                     (slurmdbd-extra-content
                                      (string-append
                                       "LogFile=/var/log/slurm/slurmdbd.log #default none, syslog"))
                                     (run-slurmdbd? #f)
                                     (run-slurmctld? #t)))
                           (simple-service 'my-cron-jobs
                                           mcron-service-type
                                           (list mcron:guix-gc-repair-job)))
                     (modify-services %kbg-desktop-services
                                      (delete gdm-service-type))))

   ;; Allow resolution of '.local' host names with mDNS.
   (name-service-switch %mdns-host-lookup-nss)))

yak-system