moses.scm (4004B)
1 (define-module (system moses) 2 #:use-module (guix gexp) 3 #:use-module (guix packages) 4 #:use-module (gnu bootloader) 5 #:use-module (gnu bootloader grub) 6 #:use-module (gnu packages wm) 7 #:use-module (gnu services) 8 #:use-module (gnu services base) 9 #:use-module (gnu services desktop) 10 #:use-module (gnu services guix) 11 #:use-module (gnu services sddm) 12 #:use-module (gnu system) 13 #:use-module (gnu system keyboard) 14 #:use-module (gnu system linux-initrd) 15 #:use-module (gnu system nss) 16 #:use-module (gnu system shadow) 17 #:use-module (nongnu packages linux) 18 #:use-module (nongnu system linux-initrd) 19 #:use-module (mt services) 20 #:use-module (mt system) 21 #:use-module (home lukejw) 22 #:use-module ((ice-9 ports) #:select (call-with-input-file)) 23 #:use-module ((ice-9 textual-ports) #:select (get-string-all)) 24 #:export (moses-os)) 25 26 (define %issue " 27 \"Keep thy mind in hell and despair not.\" 28 ") 29 30 (define (load-hosts-entries) 31 (call-with-input-file "system/hosts" 32 (lambda (p) 33 (let* ((text (get-string-all p)) 34 (lines (string-split text #\newline)) 35 (lines* (filter (lambda (l) (not (or (string-null? l) 36 (string-prefix? "#" l)))) lines))) 37 (map (lambda (l) 38 (let* ((tokens (string-split l #\space)) 39 (tokens* (filter (lambda (t) (not (string-null? t))) 40 tokens)) 41 (ip (car tokens*)) 42 (alias (cadr tokens*))) 43 (host ip alias))) 44 lines*))))) 45 46 (define moses-os 47 (operating-system 48 (host-name "moses") 49 (timezone "America/New_York") 50 (locale "en_US.utf8") 51 52 (issue %issue) 53 54 (keyboard-layout (keyboard-layout "us")) 55 56 (kernel linux-lts) 57 58 ;; Intel is not used on this machine, only AMD and Qualcomm 59 (initrd (lambda (file-systems . rest) 60 (apply microcode-initrd file-systems 61 #:initrd base-initrd 62 #:microcode-packages (list amd-microcode) 63 rest))) 64 (firmware (list amdgpu-firmware 65 atheros-firmware)) 66 67 (name-service-switch %mdns-host-lookup-nss) 68 69 (bootloader (bootloader-configuration 70 (bootloader grub-efi-bootloader) 71 (targets '("/boot/efi")) 72 (theme (grub-theme 73 (inherit (grub-theme)) 74 (resolution '(1920 . 1200)))) 75 (keyboard-layout keyboard-layout))) 76 77 (swap-devices %mt-swap-devices) 78 79 (file-systems %mt-file-systems) 80 81 (users 82 (cons* 83 (user-account 84 (name "lukejw") 85 (comment "Luke Willis") 86 (group "users") 87 (home-directory "/home/lukejw") 88 (supplementary-groups '("wheel" "netdev" "audio" "video" "kvm"))) 89 %base-user-accounts)) 90 91 ;; Add some default compositors to choose from 92 ;; TODO: Provide patched defult configurations, maybe? 93 ;; TODO: Add some simple x11 sessions for running legacy applications 94 (packages 95 (append 96 (list sway) ;; For session to be listed 97 %mt-base-packages)) 98 99 (services 100 (append 101 (list 102 (service sddm-service-type 103 (sddm-configuration 104 (display-server "wayland"))) 105 ;; TODO: Package and use StevenBlack's hosts files 106 (simple-service 'blacklist-content 107 hosts-service-type 108 (load-hosts-entries))) 109 (modify-services %mt-clergy-services 110 (delete login-service-type) 111 (delete mingetty-service-type) 112 (delete console-font-service-type)) 113 (modify-services %mt-desktop-services 114 (elogind-service-type config => (elogind-configuration 115 (inherit config) 116 (handle-lid-switch 'ignore) 117 (handle-lid-switch-external-power 'ignore)))))))) 118 119 moses-os
