From 25d09ddb7a3ddbdf49cb62168a8ab5514651fe5a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 09:11:37 +0300 Subject: Add guix configuration --- guix/home.scm | 81 ++++++++++++++++++++++++++++++++++++++++ guix/services/tailscale.scm | 66 ++++++++++++++++++++++++++++++++ guix/system.scm | 91 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 guix/home.scm create mode 100644 guix/services/tailscale.scm create mode 100644 guix/system.scm (limited to 'guix') diff --git a/guix/home.scm b/guix/home.scm new file mode 100644 index 0000000..b11fc4f --- /dev/null +++ b/guix/home.scm @@ -0,0 +1,81 @@ +;; This "home-environment" file can be passed to 'guix home reconfigure' +;; to reproduce the content of your profile. This is "symbolic": it only +;; specifies package names. To reproduce the exact same profile, you also +;; need to capture the channels being used, as returned by "guix describe". +;; See the "Replicating Guix" section in the manual. + +(use-modules (gnu packages) + (gnu packages gnupg) + (gnu services) + (guix gexp) + (gnu system) + (gnu home) + (gnu home services) + (gnu home services dotfiles) + (gnu home services shells) + (gnu home services desktop) + (gnu home services gnupg)) + +(home-environment + ;; Below is the list of packages that will show up in your + ;; Home profile, under ~/.guix-home/profile. + ;; (packages + ;; (append (map specification->package + ;; '("emacs-pgtk" "aspell-dict-el")))) + ;; Below is the list of Home services. To search for available + ;; services, run 'guix home search KEYWORD' in a terminal. + (services + (list (service home-bash-service-type + (home-bash-configuration + (guix-defaults? #f) + (aliases '(("fanki" . "flatpak run net.ankiweb.Anki") + ("ga" . "git add") + ("gaa" . "git add .") + ("gc" . "git commit -m") + ("gp" . "git push -u origin") + ("gpd" . "git push -u origin developer") + ("gpm" . "git push -u origin master") + ("grep" . "grep --color=auto") + ("gs" . "git status") + ("klight" . "brightnessctl --device='\\''tpacpi::kbd_backlight'\\'' set 1") + ("ll" . "ls -lah --color") + ("logout" . "pkill -U $USER") + ("ls" . "ls --color") + ("o" . "emacsclient -n") + ("weather" . "curl wttr.in") + ("ytd" . "yt-dlp") + ("gx" . "guix"))) + (bashrc (list (local-file "/home/thanos/dotfiles/bash-base.sh" #:recursive? #t))))) + ;; TODO: Rewrite this mess + (service home-xdg-configuration-files-service-type + `(("emacs/init.el" ,(local-file "../emacs.el")) + ("alacritty/alacritty.toml" ,(local-file "../alacritty.toml")) + ("sway/config" ,(local-file "../sway.config")) + ("waybar/config" ,(local-file "../waybar-config")) + ("waybar/style.css" ,(local-file "../waybar-style.css")))) + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories '("/home/thanos/dotfiles/")) + (excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore" ".*emacs.el" "sway\\*" "waybar-config" + "alacritty.toml" "vimium-options.json" "waybar-style.css" + ".*bash" "README" "LICENSE" ".*\\.scm" "sway.config" ".stow-local-ignore")))) + ;; Env variables + (simple-service 'profile-service-type + home-environment-variables-service-type + '(("VISUAL" . "emacsclient") + ("EDITOR" . "emacsclient") + ("GTK_THEME" . "Adwaita-dark") + ("XDG_CURRENT_DESKTOP" . "sway") + ("XDG_SESSION_TYPE" . "wayland") + ("PATH" . "/home/$USER/.local/bin:$PATH") + ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"))) + ;; GPG Configuration + (service home-gpg-agent-service-type + (home-gpg-agent-configuration + (pinentry-program + (file-append pinentry-gtk2 "/bin/pinentry-gtk-2")) + (ssh-support? #t) + (default-cache-ttl 28800) + (max-cache-ttl 28800) + (default-cache-ttl-ssh 28800) + (max-cache-ttl-ssh 28800)))))) diff --git a/guix/services/tailscale.scm b/guix/services/tailscale.scm new file mode 100644 index 0000000..0632a41 --- /dev/null +++ b/guix/services/tailscale.scm @@ -0,0 +1,66 @@ +;; Under construction + +(define-module (services tailscale) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu services configuration) + #:use-module (guix records) + #:use-module (guix gexp) + #:use-module (ice-9 match) + #:use-module (packages tailscale) + #:use-module (gnu packages linux) + #:export (tailscaled-service-type tailscaled-configuration)) + +;; TODO: https://tailscale.com/kb/1188/linux-dns/#dhcp-dhclient-overwriting-etcresolvconf + +(define-record-type* + tailscaled-configuration make-tailscaled-configuration + tailscaled-configuration? + (tailscale tailscaled-configuration-tailscale + (default tailscale)) + (listen-port tailscaled-configuration-listen-port + (default "41641")) + (state-file tailscaled-configuration-state-file + (default "tailscaled.state"))) + +(define (tailscaled-activation config) + "Run tailscaled --cleanup" + #~(begin + (system* #$(file-append tailscale "/usr/bin/tailscaled") "--cleanup"))) + +(define (tailscaled-shepherd-service config) + "Return a for Tailscaled with CONFIG" + (let ((tailscale + (tailscaled-configuration-tailscale config)) + (listen-port + (tailscaled-configuration-listen-port config)) + (state-file + (tailscaled-configuration-state-file config)) + (environment #~(list (string-append + "PATH=" ; iptables is required for tailscale to work + (string-append #$iptables "/sbin") + ":" + (string-append #$iptables "/bin"))))) + (list + (shepherd-service + (provision '(tailscaled)) + (requirement '(networking)) ;; services this depends on + (start #~(make-forkexec-constructor + (list #$(file-append tailscale "/usr/bin/tailscaled") + "-state" #$state-file + ;"-port" #$listen-port + "-verbose" "10") + #:environment-variables #$environment + #:log-file "/var/log/tailscaled.log")) + (stop #~(make-kill-destructor)))))) + +(define tailscaled-service-type + (service-type + (name 'tailscaled) + (extensions + (list (service-extension shepherd-root-service-type + tailscaled-shepherd-service) + (service-extension activation-service-type + tailscaled-activation))) + (default-value (tailscaled-configuration)) + (description "Launch tailscaled."))) diff --git a/guix/system.scm b/guix/system.scm new file mode 100644 index 0000000..2d38409 --- /dev/null +++ b/guix/system.scm @@ -0,0 +1,91 @@ +;; TODO: Use this as a base module and seperate each system/machine +(use-modules (gnu) + (gnu services) + (gnu home services desktop) + (gnu home services desktop) + (gnu home services gnupg) + (nongnu packages linux) + (nongnu system linux-initrd)) + +(use-service-modules cups desktop networking ssh xorg docker guix admin pm docker) + +(operating-system + (locale "en_US.utf8") + (timezone "Europe/Athens") + (keyboard-layout (keyboard-layout "us")) + (host-name "zeus") + + ;; TODO: Use the full linux kernel only on the desktop + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + + ;; The list of user accounts ('root' is implicit). + (users (cons* (user-account + (name "thanos") + (comment "Thanos Apollo") + (group "users") + (home-directory "/home/thanos") + (supplementary-groups '("wheel" "netdev" "audio" "video" "docker"))) + %base-user-accounts)) + + ;; Packages installed system-wide. + (packages + (append (map specification->package + '("sway" "swaylock" "swaylock-effects" "swaybg" "flatpak" + "waybar" "mu" "gnupg" "pinentry" "password-store" "isync" "python" + "sbcl" "font-jetbrains-mono" "docker" "docker-cli" "icecat" "git")) + %base-packages)) + + ;; Below is the list of system services. To search for available + ;; services, run 'guix system search KEYWORD' in a terminal. + (services + (append (list (service gnome-desktop-service-type) + (service docker-service-type) + + (service openssh-service-type + (openssh-configuration + (permit-root-login 'prohibit-password))) + ;; ;; TODO: Fix swaylock + ;; (service screen-locker-service-type + ;; (screen-locker-configuration + ;; (name "swaylock") + ;; (program (file-append swaylock "/bin/swaylock")) + ;; (using-pam? #t) + ;; (using-setuid? #f))) + + (service tor-service-type) + (service cups-service-type) + (set-xorg-configuration + (xorg-configuration (keyboard-layout keyboard-layout)))) + %desktop-services)) + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets (list "/boot/efi")) + (keyboard-layout keyboard-layout))) + (swap-devices (list (swap-space + (target (uuid + "10551e45-7810-4171-a4b2-87372ae5bdb4"))))) + + ;; run 'lsblk -f' to get UUIDs. + (file-systems (cons* (file-system + (mount-point "/hdd") + (device (uuid "b0fddf60-47ff-469f-b135-8f6b58812c99" + 'xfs)) + (type "xfs")) + (file-system + (mount-point "/home") + (device (uuid "4efbc805-e89b-46b8-b895-b1ce807698c8" + 'ext4)) + (type "ext4")) + (file-system + (mount-point "/") + (device (uuid + "e350994d-4c98-4d04-9867-29c9fc779026" + 'ext4)) + (type "ext4")) + (file-system + (mount-point "/boot/efi") + (device (uuid "F2A9-FB50" + 'fat32)) + (type "vfat")) %base-file-systems))) -- cgit v1.2.3 From 0a986710fbaf68478127f593f10f4dfa66d7b1d6 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 21:17:03 +0300 Subject: guix-home: Update packages & dotfile service --- guix/home.scm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'guix') diff --git a/guix/home.scm b/guix/home.scm index b11fc4f..02ee094 100644 --- a/guix/home.scm +++ b/guix/home.scm @@ -19,17 +19,24 @@ (home-environment ;; Below is the list of packages that will show up in your ;; Home profile, under ~/.guix-home/profile. - ;; (packages - ;; (append (map specification->package - ;; '("emacs-pgtk" "aspell-dict-el")))) + (packages (specifications->packages + (list "anki" "qtwebengine" "aspell-dict-el" "perl" "tree" + "font-iosevka-aile" "font-jetbrains-mono" "mu" "hyfetch" + "emacs-nov-el" "iptables" "emacs-yeetube" "syncthing" + "ungoogled-chromium" "emacs-pdf-tools" "python-lsp-server" + "transmission" "emacs-pgtk" "mpv" "yt-dlp" "icecat" "dino" "nyxt" + "0ad" "torbrowser" "pinentry" "emacs-elpy" "python-requests" + "python-mypy" "fuzzel" "alacritty" "wtype" "git" "emacs-geiser" + "emacs-geiser-guile" "sbcl" "curl" "libvterm" "emacs-vterm" + "inetutils" "emacs-jabber" "bind" "go" "nmap" "hunspell" + "hunspell-dict-en-us" "pinentry-emacs" "mlocate" "rsync"))) ;; Below is the list of Home services. To search for available ;; services, run 'guix home search KEYWORD' in a terminal. (services (list (service home-bash-service-type (home-bash-configuration (guix-defaults? #f) - (aliases '(("fanki" . "flatpak run net.ankiweb.Anki") - ("ga" . "git add") + (aliases '(("ga" . "git add") ("gaa" . "git add .") ("gc" . "git commit -m") ("gp" . "git push -u origin") @@ -46,19 +53,13 @@ ("ytd" . "yt-dlp") ("gx" . "guix"))) (bashrc (list (local-file "/home/thanos/dotfiles/bash-base.sh" #:recursive? #t))))) - ;; TODO: Rewrite this mess - (service home-xdg-configuration-files-service-type - `(("emacs/init.el" ,(local-file "../emacs.el")) - ("alacritty/alacritty.toml" ,(local-file "../alacritty.toml")) - ("sway/config" ,(local-file "../sway.config")) - ("waybar/config" ,(local-file "../waybar-config")) - ("waybar/style.css" ,(local-file "../waybar-style.css")))) (service home-dotfiles-service-type (home-dotfiles-configuration (directories '("/home/thanos/dotfiles/")) - (excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore" ".*emacs.el" "sway\\*" "waybar-config" - "alacritty.toml" "vimium-options.json" "waybar-style.css" - ".*bash" "README" "LICENSE" ".*\\.scm" "sway.config" ".stow-local-ignore")))) + (excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore" + ".*emacs.el" "waybar-config" "vimium-options.json" + ".*bash" "README" "LICENSE" ".*\\.scm" "__pycache__" "bash-base.sh")) + (layout 'plain))) ;; Env variables (simple-service 'profile-service-type home-environment-variables-service-type @@ -67,8 +68,7 @@ ("GTK_THEME" . "Adwaita-dark") ("XDG_CURRENT_DESKTOP" . "sway") ("XDG_SESSION_TYPE" . "wayland") - ("PATH" . "/home/$USER/.local/bin:$PATH") - ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"))) + ("PATH" . "/home/$USER/.local/bin:$PATH"))) ;; GPG Configuration (service home-gpg-agent-service-type (home-gpg-agent-configuration -- cgit v1.2.3 From 395b9780bf978eb133a6f815d995239d50f7e957 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 May 2024 21:17:19 +0300 Subject: guix-system: Remove flatpak --- guix/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/system.scm b/guix/system.scm index 2d38409..6dd0be7 100644 --- a/guix/system.scm +++ b/guix/system.scm @@ -32,7 +32,7 @@ ;; Packages installed system-wide. (packages (append (map specification->package - '("sway" "swaylock" "swaylock-effects" "swaybg" "flatpak" + '("sway" "swaylock" "swaylock-effects" "swaybg" "waybar" "mu" "gnupg" "pinentry" "password-store" "isync" "python" "sbcl" "font-jetbrains-mono" "docker" "docker-cli" "icecat" "git")) %base-packages)) -- cgit v1.2.3 From 5c5e4d98af25cf915c033349ad26069293374c83 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 12 May 2024 19:18:17 +0300 Subject: guix:(home) Update packages --- guix/home.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'guix') diff --git a/guix/home.scm b/guix/home.scm index 02ee094..b48d8fd 100644 --- a/guix/home.scm +++ b/guix/home.scm @@ -24,12 +24,13 @@ "font-iosevka-aile" "font-jetbrains-mono" "mu" "hyfetch" "emacs-nov-el" "iptables" "emacs-yeetube" "syncthing" "ungoogled-chromium" "emacs-pdf-tools" "python-lsp-server" - "transmission" "emacs-pgtk" "mpv" "yt-dlp" "icecat" "dino" "nyxt" - "0ad" "torbrowser" "pinentry" "emacs-elpy" "python-requests" + "transmission" "emacs-pgtk" "mpv" "yt-dlp" "icecat" "dino" + "0ad" "torbrowser" "emacs-elpy" "python-requests" "python-mypy" "fuzzel" "alacritty" "wtype" "git" "emacs-geiser" "emacs-geiser-guile" "sbcl" "curl" "libvterm" "emacs-vterm" "inetutils" "emacs-jabber" "bind" "go" "nmap" "hunspell" - "hunspell-dict-en-us" "pinentry-emacs" "mlocate" "rsync"))) + "hunspell-dict-en-us" "pinentry-emacs" "mlocate" "rsync" + "grimshot" "nyxt"))) ;; Below is the list of Home services. To search for available ;; services, run 'guix home search KEYWORD' in a terminal. (services -- cgit v1.2.3 From 349c9a513f69e656c1a67a65dd3171702285a116 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:03:33 +0300 Subject: guix:(home) Add browser & xdg_screenshots_dir for shell config --- guix/home.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guix') diff --git a/guix/home.scm b/guix/home.scm index b48d8fd..08fd7ce 100644 --- a/guix/home.scm +++ b/guix/home.scm @@ -69,6 +69,8 @@ ("GTK_THEME" . "Adwaita-dark") ("XDG_CURRENT_DESKTOP" . "sway") ("XDG_SESSION_TYPE" . "wayland") + ("BROWSER" . "icecat") + ("XDG_SCREENSHOTS_DIR" . "/home/$USER/Pictures/screenshots/") ("PATH" . "/home/$USER/.local/bin:$PATH"))) ;; GPG Configuration (service home-gpg-agent-service-type -- cgit v1.2.3 From 5d6840de02f01c017cc1ce99238d6962331087da Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 13 May 2024 08:42:24 +0300 Subject: guix:(system) Major rewrite --- guix/system.scm | 114 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 24 deletions(-) (limited to 'guix') diff --git a/guix/system.scm b/guix/system.scm index 6dd0be7..2a86298 100644 --- a/guix/system.scm +++ b/guix/system.scm @@ -1,14 +1,19 @@ ;; TODO: Use this as a base module and seperate each system/machine (use-modules (gnu) (gnu services) - (gnu home services desktop) - (gnu home services desktop) - (gnu home services gnupg) + (gnu services dbus) + (gnu services desktop) + (gnu system) + (gnu system setuid) + (gnu system nss) (nongnu packages linux) (nongnu system linux-initrd)) (use-service-modules cups desktop networking ssh xorg docker guix admin pm docker) +(use-package-modules nfs certs shells ssh linux bash emacs networking wm fonts libusb cups freedesktop file-systems version-control package-management) + + (operating-system (locale "en_US.utf8") (timezone "Europe/Athens") @@ -33,36 +38,97 @@ (packages (append (map specification->package '("sway" "swaylock" "swaylock-effects" "swaybg" - "waybar" "mu" "gnupg" "pinentry" "password-store" "isync" "python" - "sbcl" "font-jetbrains-mono" "docker" "docker-cli" "icecat" "git")) + "waybar" "gnupg" "pinentry" "password-store" + "isync" "python" "font-jetbrains-mono" "docker" + "docker-cli" "icecat" "git" "avahi")) %base-packages)) ;; Below is the list of system services. To search for available ;; services, run 'guix system search KEYWORD' in a terminal. (services - (append (list (service gnome-desktop-service-type) - (service docker-service-type) - - (service openssh-service-type - (openssh-configuration - (permit-root-login 'prohibit-password))) - ;; ;; TODO: Fix swaylock - ;; (service screen-locker-service-type - ;; (screen-locker-configuration - ;; (name "swaylock") - ;; (program (file-append swaylock "/bin/swaylock")) - ;; (using-pam? #t) - ;; (using-setuid? #f))) - - (service tor-service-type) - (service cups-service-type) - (set-xorg-configuration - (xorg-configuration (keyboard-layout keyboard-layout)))) - %desktop-services)) + (append (list + (service docker-service-type) + ;; tty login + (service elogind-service-type) + + (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"))) + + (service greetd-service-type + (greetd-configuration + (greeter-supplementary-groups + (list "video" "input")) + (terminals + (list + (greetd-terminal-configuration + (terminal-vt "1") + (terminal-switch #t)) + (greetd-terminal-configuration + (terminal-vt "2")) + (greetd-terminal-configuration + (terminal-vt "3")))))) + + + (service gnome-desktop-service-type) + + (service openssh-service-type + (openssh-configuration + (permit-root-login 'prohibit-password))) + + ;; (service static-networking-service-type + ;; (list %loopback-static-networking)) + + ;; TODO: Fix swaylock + (service screen-locker-service-type + (screen-locker-configuration + (name "swaylock") + (program (file-append swaylock "/bin/swaylock")) + (using-pam? #t) + (using-setuid? #f))) + + ;; Networking services + (service network-manager-service-type) + (service wpa-supplicant-service-type) ;; Needed by NetworkManager + (service modem-manager-service-type) ;; For cellular modems + + polkit-wheel-service + + (service tor-service-type) + (service cups-service-type) + ;; + ;; (service avahi-service-type) + (service udisks-service-type) + (service upower-service-type) + (service cups-pk-helper-service-type) + (service geoclue-service-type) + ;; (service polkit-service-type) + ;; (service dbus-root-service-type) + fontconfig-file-system-service ;; Manage the fontconfig cache + + ;; Power and thermal management services + (service thermald-service-type) + (service tlp-service-type + (tlp-configuration + (cpu-boost-on-ac? #t) + (wifi-pwr-on-bat? #t)))) + + (modify-services %base-services + (delete login-service-type) + (delete mingetty-service-type) + (delete console-font-service-type)))) + + (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) (targets (list "/boot/efi")) (keyboard-layout keyboard-layout))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (swap-devices (list (swap-space (target (uuid "10551e45-7810-4171-a4b2-87372ae5bdb4"))))) -- cgit v1.2.3