summaryrefslogtreecommitdiff
path: root/kolwynia/os/ymir.scm
blob: bba1b3bc452f3c639ee03d0eb962ac3a10c00bed (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
;;; Copyright © 2025 bdunahu <bdunahu@operationnull.com>
(define-module (kolwynia os ymir)
  #:use-module ((kolwynia os ymir users)
                #:prefix users:)
  #:use-module ((kolwynia os ymir packages)
                #:prefix pkg:)
  #:use-module (gnu)
  #:use-module (gnu services desktop)
  #:use-module (gnu system)
  #:use-module (gnu packages suckless)
  #:export (ymir))

;;; Commentary:
;;;
;;; ymir defines a default system configuration
;;;
;;; Code:

(use-service-modules audio admin avahi base
                     dbus desktop file-sharing
                     networking sound ssh xorg)

;;; generates a temporary file to notify a keyboard was plugged.
(define %keyboard-udev-rule
  (udev-rule
   "90-keyboard-hotplug.rules"
   (string-append "ATTR{idVendor}==\"04b4\", ATTR{idProduct}==\"0510\", ACTION==\"add\", RUN+=\"/run/current-system/profile/bin/touch /tmp/keyboard_plugged\" RUN+=\"/run/current-system/profile/bin/chown " users:bdunahu-str " /tmp/keyboard_plugged\"")))

(define ymir
  (operating-system
   (host-name "ymir")
   (locale "en_US.utf8")
   (timezone
    (if #f
        "America/New_York"
        "America/Denver"))
   (keyboard-layout
    (keyboard-layout "us"
                     #:options '("ctrl:hyper_capscontrol")))
   (kernel-arguments
    (delete "quiet"
            %default-kernel-arguments))

   (users (cons* users:bdunahu
                 %base-user-accounts))

   (bootloader (bootloader-configuration
                (bootloader grub-efi-bootloader)
                (targets (list "/boot/efi"))
                (timeout 1)
                (keyboard-layout keyboard-layout)))

   (packages pkg:ymir-packages)
   (services
    `(
      ;; so that non-root users in the wheel group can
      ;; perform administrative tasks (similar to "sudo").
      ,polkit-wheel-service
      ;; The global fontconfig cache directory can sometimes contain
      ;; stale entries, possibly referencing fonts that have been GC'd,
      ;; so mount it read-only.
      ,fontconfig-file-system-service

      ,(service network-manager-service-type)
      ,(service wpa-supplicant-service-type) ; needed by NetworkManager
      ,(service modem-manager-service-type)
      ,(service usb-modeswitch-service-type)

      ;; The D-Bus clique.
      ,(service avahi-service-type)
      ,(service udisks-service-type)
      ,(service upower-service-type)
      ,(service accountsservice-service-type)
      ,(service cups-pk-helper-service-type)
      ,(service colord-service-type)
      ,(service geoclue-service-type)
      ,(service polkit-service-type)
      ,(service elogind-service-type
                (elogind-configuration
                  (handle-power-key 'hibernate)))
      ,(service dbus-root-service-type)

      ,(service ntp-service-type)

      ;; openssh
      ,(service openssh-service-type
                (openssh-configuration
                  (x11-forwarding? #t)
                  (permit-root-login 'prohibit-password)
                  (password-authentication? #f)))

      ;; xorg
      ,(service screen-locker-service-type
                (screen-locker-configuration
                  (name "slock")
                  (program (file-append slock "/bin/slock"))))
      ,(service x11-socket-directory-service-type)
      ,(udev-rules-service 'keyboard-hotplug %keyboard-udev-rule)

      ;; audio
      ,(service pulseaudio-service-type)
      ,(service alsa-service-type)

      ;; TODO: don't do this expensive operation; just copy file.
      ;; ,(simple-service 'add-extra-hosts
      ;;                  hosts-service-type
      ;;                  (map
      ;;                   (lambda (x)
      ;;                     (host "0.0.0.0" x))
      ;;                   (read-hosts "/home/bdunahu/.config/guix/assets/blocklist.txt")))

      ,@%base-services))

   ;; OVERRIDE
   (file-systems '())))

;;; ymir.scm ends here