From 01264bfd6a09b1f1e79998a3dcb7e737b6a5e8a6 Mon Sep 17 00:00:00 2001 From: "Skylar \"The Cobra\" Widulski" Date: Sun, 4 Jun 2023 19:35:03 -0400 Subject: [PATCH] does this work (please) Signed-off-by: Skylar "The Cobra" Widulski --- .bashrc | 2 +- .config/guix/cobra/homedir.scm | 14 +- .config/guix/home.scm | 17 ++- .devspec | 14 +- etc/guix-config/cobra/lists.scm | 170 ++++++++++++++++++++++++ etc/guix-config/cobra/os.scm | 58 ++++++++ etc/guix-config/cobra/packages.scm | 23 ++++ etc/guix-config/oganesson.scm | 206 +---------------------------- 8 files changed, 273 insertions(+), 231 deletions(-) create mode 100644 etc/guix-config/cobra/lists.scm create mode 100644 etc/guix-config/cobra/os.scm create mode 100644 etc/guix-config/cobra/packages.scm diff --git a/.bashrc b/.bashrc index 64a40ee..7f890a2 100644 --- a/.bashrc +++ b/.bashrc @@ -48,7 +48,7 @@ cpusage() { } # Update and upgrade system -update() { $PRIV sh -c "$UPDATE"; } +update() { eval "$UPDATE"; } # Im too lazy to type copy() { diff --git a/.config/guix/cobra/homedir.scm b/.config/guix/cobra/homedir.scm index fafe269..5ca5632 100644 --- a/.config/guix/cobra/homedir.scm +++ b/.config/guix/cobra/homedir.scm @@ -16,21 +16,9 @@ if [[ $HOSTNAME == pp ]]; then PASTE_COMMAND=\"wl-paste\" WIFI=wlan0 WM=\"bash\" -elif [[ $HOSTNAME == Oganesson ]]; then - PRIV=sudo - UPDATE=\"guix pull --branch=master && reconf && hreconf\" - COPY_COMMAND=\"wl-copy\" - PASTE_COMMAND=\"wl-paste\" - WIFI=wlp2s0 - WM='sway' +elif [[ $HOSTNAME == Oganesson ]]; then : #export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 elif [[ $HOSTNAME == Neon ]]; then - PRIV=sudo - UPDATE=\"guix pull --branch=master && reconf && hreconf\" - COPY_COMMAND=\"wl-copy\" - PASTE_COMMAND=\"wl-paste\" - WIFI=wlp2s0 - WM='sway' export WLR_NO_HARDWARE_CURSORS=1 else PRIV=sudo diff --git a/.config/guix/home.scm b/.config/guix/home.scm index f056bb1..94a3a48 100644 --- a/.config/guix/home.scm +++ b/.config/guix/home.scm @@ -1,10 +1,13 @@ +(add-to-load-path "/etc/guix-config") (add-to-load-path "/home/cobra/.config/guix") (use-modules (gnu home) (gnu home services) (gnu home services mcron) (gnu home services desktop) + (gnu home services shells) (gnu packages) + (gnu packages gl) (gnu services) (gnu services dbus) (gnu services mcron) @@ -13,7 +16,8 @@ ;; Deranged Guix Home Usage(TM) (cobra homedir) (cobra config) - (cobra bin)) + (cobra bin) + (cobra packages)) (define webfetch-job #~(job "*/1 * * * *" @@ -151,6 +155,17 @@ (service home-mcron-service-type (home-mcron-configuration (jobs (list webfetch-job)))) + (simple-service 'home-env + home-environment-variables-service-type + `(("LIBGL_DRIVERS_PATH" . ,(if (eq? (gethostname) "Neon") + (file-append mesa-i915 "/lib/dri") + (file-append mesa "/lib/dri"))) + ("PRIV" . "sudo") + ("WM" . "sway") + ("WIFI" . "wlp2s0") + ("COPY_COMMAND" . "wl-copy") + ("PASTE_COMMAND" . "wl-paste") + ("UPDATE" . "guix pull --branch=master && reconf && hreconf"))) (simple-service 'dotfiles home-files-service-type (list `(".bashrc" ,bashrc) diff --git a/.devspec b/.devspec index 58ce589..b13a769 100644 --- a/.devspec +++ b/.devspec @@ -7,21 +7,9 @@ if [[ $HOSTNAME == pp ]]; then PASTE_COMMAND="wl-paste" WIFI=wlan0 WM="bash" -elif [[ $HOSTNAME == Oganesson ]]; then - PRIV=sudo - UPDATE="guix pull --branch=master && guix system reconfigure /etc/guix-config/${HOSTNAME,,}.scm && guix package -u" - COPY_COMMAND="wl-copy" - PASTE_COMMAND="wl-paste" - WIFI=wlp2s0 - WM='sway' +elif [[ $HOSTNAME == Oganesson ]]; then : #export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 elif [[ $HOSTNAME == Neon ]]; then - PRIV=sudo - UPDATE="guix pull --branch=master && guix system reconfigure /etc/guix-config/${HOSTNAME,,}.scm && guix package -u" - COPY_COMMAND="wl-copy" - PASTE_COMMAND="wl-paste" - WIFI=wlp2s0 - WM='sway' export WLR_NO_HARDWARE_CURSORS=1 else PRIV=sudo diff --git a/etc/guix-config/cobra/lists.scm b/etc/guix-config/cobra/lists.scm new file mode 100644 index 0000000..4c85083 --- /dev/null +++ b/etc/guix-config/cobra/lists.scm @@ -0,0 +1,170 @@ +(add-to-load-path "/etc/guix-config") + +(define-module (cobra lists) + #:use-module (guix gexp) + + #:use-module (gnu) + #:use-module (gnu services) + #:use-module (gnu services base) + #:use-module (gnu services desktop) + #:use-module (gnu services networking) + #:use-module (gnu services xorg) + #:use-module (gnu services cups) + #:use-module (gnu services ssh) + #:use-module (gnu services dbus) + #:use-module (gnu services virtualization) + #:use-module (gnu services authentication) + #:use-module (gnu services dict) + #:use-module (gnu services linux) + + #:use-module (gnu packages certs) + #:use-module (gnu packages wordnet) + #:use-module (gnu packages wm) + #:use-module (gnu packages dictionaries) + + #:use-module (cobra packages) + + #:export (service-list + package-list)) + +;; DICT +(define wordnet-handler + (dicod-handler + (name "wordnet") + (module "dictorg") + (options + (list #~(string-append "dbdir=" #$wordnet))))) +(define vera-handler + (dicod-handler + (name "vera") + (module "dictorg") + (options + (list #~(string-append "dbdir=" #$vera))))) + +(define wordnet-db + (dicod-database + (name "wordnet") + (complex? #t) + (handler "wordnet") + (options '("database=wn")))) +(define vera-db + (dicod-database + (name "vera") + (complex? #t) + (handler "vera") + (options '("database=vera")))) + +;; Kernel +(define v4l2loopback-config + (plain-file "v4l2loopback.conf" + "options v4l2loopback video_nr=6,7,8,9 card_label=loopback0,loopback1,loopback2,loopback3 exclusive_caps=1")) + +(define service-list + (cons* + ;; Bluetooth + (service bluetooth-service-type + (bluetooth-configuration + (auto-enable? #t))) + + ;; Desktop + (service screen-locker-service-type + (screen-locker-configuration + (name "swaylock") + (program (file-append swaylock "/bin/swaylock")) + (allow-empty-password? #f) + (using-pam? #t) + (using-setuid? #f))) + + ;; DICT + (service dicod-service-type + (dicod-configuration + (handlers (list wordnet-handler vera-handler)) + (databases (list wordnet-db vera-db %dicod-database:gcide)))) + + ;; Kernel + (service kernel-module-loader-service-type + '("v4l2loopback")) + (simple-service 'v4l2loopback etc-service-type + (list `("modprobe.d/v4l2loopback.conf" + ,v4l2loopback-config))) + + ;; Network + (service cups-service-type) + (service network-manager-service-type) + (service ntp-service-type) + (service tor-service-type + (tor-configuration + (config-file (plain-file "tor-config" + "HTTPTunnelPort 127.0.0.1:9250")))) + (service wpa-supplicant-service-type) + + ;; System + (service dbus-root-service-type) + (service elogind-service-type) + (service openssh-service-type + (openssh-configuration + (permit-root-login 'prohibit-password) + (password-authentication? #f))) + (service gpm-service-type) + + ;; Virtualization + (service libvirt-service-type + (libvirt-configuration + (unix-sock-group "libvirt"))) + (service virtlog-service-type) + %base-services)) + +(define package-list + (append + (map specification->package+output + (list ;; Bluetooth + "bluez" + + ;; DVD + "libdvdcss" + "libdvdread" + + ;; Fonts + "font-awesome" + "font-fira-code" + "font-fira-mono" + "font-fira-sans" + "font-google-noto" + "font-google-noto-sans-cjk" + "font-google-noto-serif-cjk" + "font-liberation" + + ;; Gamedev + "godot" + + ;; Graphics + "intel-vaapi-driver" + "mesa" + "mesa-utils" + + ;; Kernel + "v4l2loopback-linux-module" + + ;; Network + "nss-certs" + "torsocks" + "tor" + + ;; System + "acpi" + "cryptsetup" + "curl" + "dconf" + "gnunet" + "lvm2" + "openssh" + "openssl" + + ;; Utilities + "vim" + + ;; Virtualization + "libvirt" + "virt-manager" + "qemu")) + (cons* mesa-i915 %base-packages))) diff --git a/etc/guix-config/cobra/os.scm b/etc/guix-config/cobra/os.scm new file mode 100644 index 0000000..235d953 --- /dev/null +++ b/etc/guix-config/cobra/os.scm @@ -0,0 +1,58 @@ +(add-to-load-path "/etc/guix-config") + +(define-module (cobra os) + #:use-module (gnu) + #:use-module (gnu system nss) + #:use-module (gnu packages linux) + #:use-module (guix gexp) + #:use-module (cobra packages) + #:use-module (cobra lists) + #:export (guix-thinkpad)) + +(define sudoers + (plain-file "sudoers" "\ +root ALL=(ALL) ALL +%wheel ALL=(ALL) ALL +Cmnd_Alias WITHOUTPW = /home/cobra/.local/bin/__suspend, /home/cobra/.local/bin/beep, /run/current-system/profile/sbin/halt, /run/current-system/profile/sbin/reboot +Defaults!WITHOUTPW !authenticate +")) + +(define guix-thinkpad + (operating-system + (kernel linux-libre) + (kernel-loadable-modules (list v4l2loopback-linux-module)) + (kernel-arguments '("intel_iommu=on" + "kvm.ignore_msrs=1" + "log_buf_len=1M")) + (keyboard-layout (keyboard-layout "us" "altgr-intl")) + (bootloader + (bootloader-configuration + (bootloader (bootloader + (inherit grub-bootloader) + (installer #~(const #t)))) + (keyboard-layout keyboard-layout))) + (host-name "ThinkPad") + (file-systems %base-file-systems) + (users (append (list + (user-account + (name "cobra") + (comment "Skylar \"The Cobra\" Widulski") + (group "users") + (supplementary-groups '("audio" + "cdrom" + "dialout" + "input" + "kvm" + "libvirt" + "lp" + "netdev" + "tape" + "video" + "wheel")))) + %base-user-accounts)) + (packages package-list) + (timezone "America/New_York") + (locale "en_US.utf8") + (name-service-switch %mdns-host-lookup-nss) + (services service-list) + (sudoers-file sudoers))) diff --git a/etc/guix-config/cobra/packages.scm b/etc/guix-config/cobra/packages.scm new file mode 100644 index 0000000..47993c0 --- /dev/null +++ b/etc/guix-config/cobra/packages.scm @@ -0,0 +1,23 @@ +(define-module (cobra packages) + #:use-module (guix packages) + #:use-module (guix gexp) + #:use-module (gnu packages gl)) + +(define-public mesa-i915 + (package (inherit mesa) + (name "mesa-i915") + (arguments + (list + #:configure-flags + #~(list "-Dgallium-drivers=svga,swrast,i915" + "-Dplatforms=x11,wayland" + "-Dglx=dri" + "-Dosmesa=true" + "-Dgles2=enabled" + "-Dgbm=enabled" + "-Dshared-glapi=enabled" + "-Dvulkan-drivers=intel,amd" + "-Dvulkan-layers=device-select,overlay" + "-Dvideo-codecs=vc1dec,h264dec,h264enc,h265dec,h265enc" + "-Dbuild-tests=true" + "-Dllvm=enabled"))))) diff --git a/etc/guix-config/oganesson.scm b/etc/guix-config/oganesson.scm index 50b463c..c78bc3b 100644 --- a/etc/guix-config/oganesson.scm +++ b/etc/guix-config/oganesson.scm @@ -1,79 +1,9 @@ (add-to-load-path "/etc/guix-config") -(use-modules - (gnu) - (gnu system nss) - (gnu packages certs) - (gnu packages linux) - (gnu packages wm) - (gnu packages wordnet) - (gnu packages dictionaries) - (gnu services desktop) - (gnu services networking) - (gnu services xorg) - (gnu services cups) - (gnu services ssh) - (gnu services dbus) - (gnu services virtualization) - (gnu services authentication) - (gnu services dict) - (gnu services linux)) - -;; DICT -(define wordnet-handler - (dicod-handler - (name "wordnet") - (module "dictorg") - (options - (list #~(string-append "dbdir=" #$wordnet))))) -(define vera-handler - (dicod-handler - (name "vera") - (module "dictorg") - (options - (list #~(string-append "dbdir=" #$vera))))) - -(define wordnet-db - (dicod-database - (name "wordnet") - (complex? #t) - (handler "wordnet") - (options '("database=wn")))) -(define vera-db - (dicod-database - (name "vera") - (complex? #t) - (handler "vera") - (options '("database=vera")))) - -;; Kernel -(define v4l2loopback-config - (plain-file "v4l2loopback.conf" - "options v4l2loopback video_nr=6,7,8,9 card_label=loopback0,loopback1,loopback2,loopback3 exclusive_caps=1")) - -;; System -(define sudoers - (plain-file "sudoers" "\ -root ALL=(ALL) ALL -%wheel ALL=(ALL) ALL -Cmnd_Alias WITHOUTPW = /home/cobra/.local/bin/__suspend, /home/cobra/.local/bin/beep, /run/current-system/profile/sbin/halt, /run/current-system/profile/sbin/reboot -Defaults!WITHOUTPW !authenticate -")) - +(use-modules (gnu) (cobra os)) (operating-system - (kernel linux-libre) - (kernel-loadable-modules (list v4l2loopback-linux-module)) - (kernel-arguments '("intel_iommu=on" - "kvm.ignore_msrs=1" - "log_buf_len=1M")) - (keyboard-layout (keyboard-layout "us" "altgr-intl")) - (bootloader - (bootloader-configuration - (bootloader (bootloader - (inherit grub-bootloader) - (installer #~(const #t)))) - (keyboard-layout keyboard-layout))) + (inherit guix-thinkpad) (host-name "Oganesson") (mapped-devices (list (mapped-device @@ -93,134 +23,4 @@ Defaults!WITHOUTPW !authenticate (options "space_cache=v2") (needed-for-boot? #t) (dependencies mapped-devices))) - %base-file-systems)) - (users (append (list - (user-account - (name "cobra") - (comment "Skylar \"The Cobra\" Widulski") - (group "users") - (supplementary-groups '("audio" - "cdrom" - "dialout" - "input" - "kvm" - "libvirt" - "lp" - "netdev" - "tape" - "video" - "wheel")))) - %base-user-accounts)) - (packages (append - (map specification->package+output - (list ;; Bluetooth - "bluez" - - ;; DVD - "libdvdcss" - "libdvdread" - - ;; Fonts - "font-awesome" - "font-fira-code" - "font-fira-mono" - "font-fira-sans" - "font-google-noto" - "font-google-noto-sans-cjk" - "font-google-noto-serif-cjk" - "font-liberation" - - ;; Gamedev - "godot" - - ;; Graphics - "intel-vaapi-driver" - "mesa" - "mesa-utils" - - ;; Kernel - "v4l2loopback-linux-module" - - ;; Network - "nss-certs" - "torsocks" - "tor" - - ;; System - "acpi" - "cryptsetup" - "curl" - "dconf" - "gnunet" - "lvm2" - "openssh" - "openssl" - - ;; Utilities - "vim" - - ;; Virtualization - "libvirt" - "virt-manager" - "qemu")) - (cons* - %base-packages))) - (timezone "America/New_York") - (locale "en_US.utf8") - (name-service-switch %mdns-host-lookup-nss) - (services - (cons* - ;; Bluetooth - (service bluetooth-service-type - (bluetooth-configuration - (auto-enable? #t))) - - ;; Desktop - (service screen-locker-service-type - (screen-locker-configuration - "swaylock" (file-append swaylock "/bin/swaylock") #f)) - - ;; DICT - (service dicod-service-type - (dicod-configuration - (handlers (list wordnet-handler vera-handler)) - (databases (list wordnet-db vera-db %dicod-database:gcide)))) - - ;; Kernel - (service kernel-module-loader-service-type - '("v4l2loopback")) - (simple-service 'v4l2loopback etc-service-type - (list `("modprobe.d/v4l2loopback.conf" - ,v4l2loopback-config))) - - ;; Network - (service cups-service-type) - (service network-manager-service-type) - (service ntp-service-type) - (service tor-service-type - (tor-configuration - (config-file (plain-file "tor-config" - "HTTPTunnelPort 127.0.0.1:9250")))) - (service wpa-supplicant-service-type) - - ;; System - (service dbus-root-service-type) - (service elogind-service-type) - (service openssh-service-type - (openssh-configuration - (permit-root-login 'prohibit-password) - (password-authentication? #f))) - (service gpm-service-type) - - ;; Virtualization - (service libvirt-service-type - (libvirt-configuration - (unix-sock-group "libvirt"))) - (service virtlog-service-type) - - (modify-services %base-services - (guix-service-type - config => (guix-configuration - (inherit config) - (http-proxy "http://localhost:9250")))))) - (sudoers-file sudoers)) + %base-file-systems)))