From d6a539885ed5214f152750d9a5d5cf01e5abbe19 Mon Sep 17 00:00:00 2001 From: Chris Cochru Date: Tue, 27 Jun 2023 15:43:47 -0500 Subject: [PATCH] adding base.scm --- guix/base.scm | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 guix/base.scm diff --git a/guix/base.scm b/guix/base.scm new file mode 100644 index 0000000..6cb857e --- /dev/null +++ b/guix/base.scm @@ -0,0 +1,206 @@ +;; This file is my OS base +;; +;; Author: Chris Cochrun +;; Email: chris@cochrun.xyz +;; +;; License: GPLv3 +;; + +(define-module (base) + #:use-module (gnu) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu services dbus) + #:use-module (gnu system) + #:use-module (gnu system setuid) + #:use-module (gnu system nss) + #:use-module (gnu system shadow) + #:use-module (gnu packages android) + #:use-module (rosenthal packages wm) + #:use-module (nongnu packages linux) + #:use-module (nongnu system linux-initrd) + #:export (base-system-packages base-operating-system)) + +(use-service-modules cups desktop networking ssh xorg avahi + admin base nix dbus pm audio virtualization sysctl) + +(use-package-modules nfs certs shells ssh linux bash emacs gnome networking wm fonts glib libusb + cups freedesktop file-systems version-control package-management) + +(define etc-sudoers-config + (plain-file "etc-sudoers-config" + "Defaults timestamp_timeout=480 +root ALL=(ALL) ALL +%wheel ALL=(ALL) ALL +YOUR-USER-NAME ALL=(ALL) NOPASSWD:/run/current-system/profile/bin/chvt,/run/current-system/profile/bin/loginctl")) + +(define-public base-system-packages + (packages (append (map specification->package + '( "nss-certs" + "sway" + "dbus-glib" + "hyprland" + "libvdpau" + "android-udev-rules" + "adb" + "fastboot" + "vulkan-tools" + "vulkan-headers" + "libva" + "libva-utils" + "intel-vaapi-driver" + "libvdpau" + "libvdpau-va-gl" + "emacs-next-pgtk")) + %base-packages))) + +(define-public base-system-services + (services + (append + (list ;; To configure OpenSSH, pass an 'openssh-configuration' + ;; record as a second argument to 'service' below. + (service openssh-service-type) + fontconfig-file-system-service + (service sane-service-type) + (service cups-service-type + (cups-configuration + (web-interface? #t) + (extensions + (list cups-filters)))) + + (simple-service 'mtp udev-service-type (list libmtp)) + (udev-rules-service 'pipewire-add-udev-rules pipewire) + (udev-rules-service 'brightnessctl-udev-rules brightnessctl) + (udev-rules-service 'android android-udev-rules + #:groups '("adbusers")) + + (service nix-service-type) + + (service screen-locker-service-type + (screen-locker-configuration + (name "swaylock") + (program (file-append 'swaylock-effects "/home/chris/.guix-home/profile/bin/swaylock")) + (allow-empty-password? #f) + (using-pam? #t) + (using-setuid? #f))) + + (set-xorg-configuration + (xorg-configuration (keyboard-layout keyboard-layout))) + + (service console-font-service-type + (map (lambda (tty) + ;; Use a larger font for HIDPI screens + (cons tty (file-append + font-terminus + "/share/consolefonts/ter-132n"))) + '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) + + (service greetd-service-type + (greetd-configuration + (greeter-supplementary-groups + (list "input" "video")) + (terminals + (list + (greetd-terminal-configuration + (terminal-vt "1") + (terminal-switch #t) + (default-session-command + (greetd-agreety-session + (command + (file-append dbus "/bin/dbus-run-session")) + (command-args (list "Hyprland"))))) + (greetd-terminal-configuration (terminal-vt "2")) + (greetd-terminal-configuration (terminal-vt "3")) + (greetd-terminal-configuration (terminal-vt "4")) + (greetd-terminal-configuration (terminal-vt "5")) + (greetd-terminal-configuration (terminal-vt "6")))))) + + ;; NetworkManager and its applet. + (service network-manager-service-type) + (service wpa-supplicant-service-type) ;needed by NetworkManager + (simple-service 'network-manager-applet + profile-service-type + (list network-manager-applet)) + (service modem-manager-service-type) + (service usb-modeswitch-service-type) + (service bluetooth-service-type + (bluetooth-configuration + (auto-enable? #t))) + + ;; The D-Bus clique. + polkit-wheel-service + (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) + (service dbus-root-service-type) + + (service ntp-service-type) + + (service x11-socket-directory-service-type)) + + (modify-services %base-services + (guix-service-type config => (guix-configuration + (inherit config) + (substitute-urls + (append (list "https://substitutes.nonguix.org") + %default-substitute-urls)) + (authorized-keys + (append (list (plain-file "nonguix.pub" "(public-key (ecc (curve Ed25519) (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)))")) + %default-authorized-guix-keys)))) + ;; greetd-service-type provides "greetd" PAM service + (delete login-service-type) + (delete console-font-service-type) + ;; and can be used in place of mingetty-service-type + (delete mingetty-service-type) + (delete mingetty-service-type) + (delete mingetty-service-type) + (delete mingetty-service-type) + (delete mingetty-service-type) + (delete mingetty-service-type))) )) + +(define-public base-operating-system + (operating-system + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + (locale "en_US.utf8") + (timezone "America/Chicago") + (keyboard-layout (keyboard-layout "us")) + (host-name "narnia") + + ;; Additional kernel modules + (kernel-loadable-modules (list v4l2loopback-linux-module)) + + ;; The list of user accounts ('root' is implicit). + (users (cons* (user-account + (name "chris") + (comment "Chris") + (group "users") + (home-directory "/home/chris") + (supplementary-groups '("wheel" "netdev" "tty" "audio" "video" "adbusers"))) + %base-user-accounts)) + + (sudoers-file etc-sudoers-config) + (packages base-system-packages) + (services base-system-services) + + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + + ;; Guix doesn't like it when there isn't a file-systems + ;; entry, so add one that is meant to be overridden + (file-systems (cons* + (file-system + (mount-point "/tmp") + (device "none") + (type "tmpfs") + (check? #f)) + %base-file-systems))))