;; 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 home services) (gnu home services desktop) (gnu home services fontutils) (gnu home services gnupg) (gnu home services mcron) (gnu home services shepherd) (gnu home services shells) (gnu home services sound) (gnu home services ssh) (gnu home) (gnu packages admin) (gnu packages algebra) (gnu packages android) (gnu packages base) (gnu packages bash) (gnu packages bittorrent) (gnu packages calendar) (gnu packages ccache) (gnu packages certs) (gnu packages chromium) (gnu packages cmake) (gnu packages commencement) (gnu packages compression) (gnu packages compton) (gnu packages containers) (gnu packages curl) (gnu packages disk) (gnu packages elf) (gnu packages emacs) (gnu packages emulators) (gnu packages fediverse) (gnu packages file) (gnu packages fonts) (gnu packages freedesktop) (gnu packages gimp) (gnu packages gnome) (gnu packages gnupg) (gnu packages gnuzilla) (gnu packages golang) (gnu packages image) (gnu packages image-viewers) (gnu packages imagemagick) (gnu packages irc) (gnu packages libreoffice) (gnu packages librewolf) (gnu packages linux) (gnu packages llvm) (gnu packages mail) (gnu packages messaging) (gnu packages music) (gnu packages ncurses) (gnu packages networking) (gnu packages ntp) (gnu packages package-management) (gnu packages password-utils) (gnu packages pdf) (gnu packages photo) (gnu packages pulseaudio) (gnu packages python-xyz) (gnu packages rsync) (gnu packages rust) (gnu packages rust-apps) (gnu packages syndication) (gnu packages telephony) (gnu packages terminals) (gnu packages tmux) (gnu packages tor) (gnu packages tree-sitter) (gnu packages version-control) (gnu packages video) (gnu packages vim) (gnu packages virtualization) (gnu packages vnc) (gnu packages w3m) (gnu packages web) (gnu packages wm) (gnu packages xdisorg) (gnu packages xfce) (luca packages dulcepan) ((luca packages factorio) #:prefix luca-factorio:) (luca packages matcha) (luca packages runit) (luca packages vsv) (luca packages wl-gammactl) (gnu services) (gnu services configuration) (guix build utils) (guix channels) (guix gexp) (ice-9 ftw) (ice-9 match) (ice-9 string-fun)) (define (file-not-symlink-check file stat) (not (symbolic-link? file))) (define-maybe boolean) ;;; Copied 1-1 from https://issues.guix.gnu.org/76619 ;;; ;;; Waiting for Wayland. ;;; (define (wayland-shepherd-service config) (list (shepherd-service (provision '(wayland-display)) (modules '((ice-9 ftw) (ice-9 regex) (ice-9 match) (srfi srfi-1) (shepherd support))) (respawn? #t) (respawn-limit config) (respawn-delay 1) (start #~(lambda* (#:optional (env-wayland-display (getenv "WAYLAND_DISPLAY"))) (define wayland-socket-regex "wayland-[0-9]+$") (define (find-socket directory regex) (find (match-lambda ((or "." "..") #f) (name (let ((name (in-vicinity directory name))) (and (string-match regex name) (access? name O_RDWR))))) ;; Wayland names its sockets ‘wayland-n’. With ;; ‘reverse’, we pick up on the last Wayland instance ;; created (essentially what we always want to do). (or (reverse (scandir directory)) '()))) (define wayland-display (or env-wayland-display (find-socket %user-runtime-dir "wayland-[0-9]+$"))) (when wayland-display (format #t "Wayland display found at ~s.~%" wayland-display) ;; Note: 'make-forkexec-constructor' calls take their ;; default #:environment-variables value before this service ;; is started and are thus unaffected by the 'setenv' call ;; below. Users of this service have to explicitly query ;; its value. (setenv "WAYLAND_DISPLAY" wayland-display)) wayland-display)) (stop #~(lambda (_) (unsetenv "WAYLAND_DISPLAY") #f))))) (define home-wayland-service-type (service-type (name 'home-wayland-display) (extensions (list (service-extension home-shepherd-service-type wayland-shepherd-service))) (default-value 10) (description "Create a @code{wayland-display} Shepherd service that waits for a Wayland compositor to be up and running, up to a configurable delay, and sets the @code{WAYLAND_DISPLAY} environment variable of @command{shepherd} itself accordingly. If no accessible Wayland server shows up during that time, the @code{wayland-display} service is marked as failing to start."))) ;;; Copied from redshift ;;; ;;; Matcha ;;; (define-configuration home-matcha-configuration (matcha (file-like matcha) "Matcha package to use.") (start-off maybe-boolean "Whether to start daemon with inhibitor off.")) (define (matcha-shepherd-service config) (list (shepherd-service (documentation "Matcha program.") (provision '(matcha)) ;; Depend on 'wayland-display', which sets 'WAYLAND_DISPLAY' if a ;; wayland server is available, and fails to start otherwise. (requirement '(wayland-display)) (modules '((srfi srfi-1) (srfi srfi-26))) (start #~(lambda _ (fork+exec-command (list #$(file-append (home-matcha-configuration-matcha config) "/bin/matcha") "--daemon" (if #$(home-matcha-configuration-start-off config) "--off")) ;; Inherit the 'WAYLAND_DISPLAY' variable set by 'wayland-display'. #:environment-variables (cons (string-append "WAYLAND_DISPLAY=" (getenv "WAYLAND_DISPLAY")) (remove (cut string-prefix? "WAYLAND_DISPLAY=" <>) (default-environment-variables)))))) (stop #~(make-kill-destructor))))) (define home-matcha-service-type (service-type (name 'home-matcha) (extensions (list (service-extension home-shepherd-service-type matcha-shepherd-service) ;; Ensure 'home-wayland-service-type is instantiated so we ;; can depend on the Shepherd 'wayland-display' service. (service-extension home-wayland-service-type (const #t)))) (default-value (home-matcha-configuration)) (description "Run matcha, a program that keeps the screen from idling."))) (define (natural-number? obj) (and (integer? obj) (exact? obj) (> obj 0))) (define (string-list? lst) (and (pair? lst) (every string? lst))) (define-maybe natural-number) (define-maybe string-list) (define-maybe string) (define-configuration home-wvkbd-configuration (wvkbd (file-like wvkbd) "wvkbd package to use.") (debug maybe-boolean "Enable debug.") (print-pressed-keys maybe-boolean "Print pressed keys to standard output.") (print-intersected-keys maybe-boolean "Print intersected keys to standard output.") (height maybe-natural-number "Height in pixels.") (landscape-height maybe-natural-number "Landscape height in pixels.") (font maybe-string "Set font (e.g: DejaVu Sans 20).") (start-hidden maybe-boolean "Start hidden (send SIGUSR2 to show).") (alpha maybe-natural-number "Set alpha value for all colors [0-255].") (bg maybe-string "Set color of background.") (fg maybe-string "Set color of keys.") (fg-sp maybe-string "Set color of special keys.") (press maybe-string "Set color of pressed keys.") (press-sp maybe-string "Set color of special pressed keys.") (swipe maybe-string "Set color of special swiped keys.") (swipe-sp maybe-string "Set color of special swiped keys.") (text maybe-string "Set color of text on keys.") (text-sp maybe-string "Set color of text on special keys.") (layers maybe-string-list "Comma separated list of layers.") (landscape-layers maybe-string-list "Comma separated list of landscape layers.")) (define (wvkbd-shepherd-service config) (list (shepherd-service (documentation "On screen keyboard") (provision '(wvkbd)) ;; Depend on 'wayland-display', which sets 'WAYLAND_DISPLAY' if a ;; wayland server is available, and fails to start otherwise. (requirement '(wayland-display)) (modules '((srfi srfi-1) (srfi srfi-26))) (start #~(lambda _ (fork+exec-command (append (list #$(file-append (home-wvkbd-configuration-wvkbd config) "/bin/wvkbd-mobintl")) (if #$(home-wvkbd-configuration-start-hidden config) '("--hidden")) (if #$(maybe-value-set? (home-wvkbd-configuration-font config)) (list "--fn" #$(home-wvkbd-configuration-font config))) (if #$(maybe-value-set? (home-wvkbd-configuration-landscape-height config)) (list "-L" (number->string #$ (home-wvkbd-configuration-landscape-height config)))) (if #$(maybe-value-set? (home-wvkbd-configuration-height config)) (list "-H" (number->string #$ (home-wvkbd-configuration-height config)))) (if #$(maybe-value-set? (home-wvkbd-configuration-alpha config)) (list "--alpha" (number->string #$ (home-wvkbd-configuration-alpha config)))) (if #$(maybe-value-set? (home-wvkbd-configuration-bg config)) (list "--bg" #$(home-wvkbd-configuration-bg config))) (if #$(maybe-value-set? (home-wvkbd-configuration-fg config)) (list "--fg" #$(home-wvkbd-configuration-fg config))) (if #$(maybe-value-set? (home-wvkbd-configuration-fg-sp config)) (list "--fg-sp" #$(home-wvkbd-configuration-fg-sp config))) (if #$(maybe-value-set? (home-wvkbd-configuration-press config)) (list "--press" #$(home-wvkbd-configuration-press config))) (if #$(maybe-value-set? (home-wvkbd-configuration-press-sp config)) (list "--swipe" #$(home-wvkbd-configuration-swipe config))) (if #$(maybe-value-set? (home-wvkbd-configuration-swipe-sp config)) (list "--swipe-sp" #$(home-wvkbd-configuration-swipe-sp config))) (if #$(maybe-value-set? (home-wvkbd-configuration-text config)) (list "--text" #$(home-wvkbd-configuration-text config))) (if #$(maybe-value-set? (home-wvkbd-configuration-text-sp config)) (list "--text-sp" #$(home-wvkbd-configuration-text-sp config))) (if #$(maybe-value-set? (home-wvkbd-configuration-layers config)) (list "-l" (string-join #$ (home-wvkbd-configuration-layers config) ","))) (if #$(maybe-value-set? (home-wvkbd-configuration-landscape-layers config)) (list "--landscape-layers" (string-join #$ (home-wvkbd-configuration-landscape-layers config) ",")))) ;; Inherit the 'DISPLAY' variable set by 'x11-display'. #:environment-variables (cons (string-append "WAYLAND_DISPLAY=" (getenv "WAYLAND_DISPLAY")) (remove (cut string-prefix? "WAYLAND_DISPLAY=" <>) (default-environment-variables)))))) (stop #~(make-kill-destructor))))) (define home-wvkbd-service-type (service-type (name 'home-wvkbd) (extensions (list (service-extension home-shepherd-service-type wvkbd-shepherd-service) ;; Ensure 'home-wayland-service-type is instantiated so we ;; can depend on the Shepherd 'wayland-display' service. (service-extension home-wayland-service-type (const #t)))) (default-value (home-wvkbd-configuration)) (description "Run wvkbd, a program that displays an on screen keyboard."))) (define-configuration home-dunst-configuration (dunst (file-like dunst) "Dunst package to use.")) (define (dunst-shepherd-service config) (list (shepherd-service (documentation "dunst program.") (provision '(dunst)) ;; Depend on 'wayland-display', which sets 'WAYLAND_DISPLAY' if a ;; wayland server is available, and fails to start otherwise. (requirement '(wayland-display)) (modules '((srfi srfi-1) (srfi srfi-26))) (start #~(lambda _ (fork+exec-command (list #$(file-append (home-dunst-configuration-dunst config) "/bin/dunst")) ;; Inherit the 'WAYLAND_DISPLAY' variable set by 'wayland-display'. #:environment-variables (cons (string-append "WAYLAND_DISPLAY=" (getenv "WAYLAND_DISPLAY")) (remove (cut string-prefix? "WAYLAND_DISPLAY=" <>) (default-environment-variables)))))) (stop #~(make-kill-destructor))))) (define home-dunst-service-type (service-type (name 'home-dunst) (extensions (list (service-extension home-shepherd-service-type dunst-shepherd-service) ;; Ensure 'home-wayland-service-type is instantiated so we ;; can depend on the Shepherd 'wayland-display' service. (service-extension home-wayland-service-type (const #t)))) (default-value (home-dunst-configuration)) (description "Run dunst, a notification daemon"))) (define-configuration home-swaynotificationcenter-configuration (swaynotificationcenter (file-like swaynotificationcenter) "SwayNotificationCenter package to use.")) (define (swaynotificationcenter-shepherd-service config) (list (shepherd-service (documentation "swaynotificationcenter program.") (provision '(swaynotificationcenter)) ;; Depend on 'wayland-display', which sets 'WAYLAND_DISPLAY' if a ;; wayland server is available, and fails to start otherwise. (requirement '(wayland-display)) (modules '((srfi srfi-1) (srfi srfi-26))) (start #~(lambda _ (fork+exec-command (list #$(file-append (home-swaynotificationcenter-configuration-swaynotificationcenter config) "/bin/swaync")) ;; Inherit the 'WAYLAND_DISPLAY' variable set by 'wayland-display'. #:environment-variables (cons (string-append "WAYLAND_DISPLAY=" (getenv "WAYLAND_DISPLAY")) (remove (cut string-prefix? "WAYLAND_DISPLAY=" <>) (default-environment-variables)))))) (stop #~(make-kill-destructor))))) (define home-swaynotificationcenter-service-type (service-type (name 'home-swaynotificationcenter) (extensions (list (service-extension home-shepherd-service-type swaynotificationcenter-shepherd-service) ;; Ensure 'home-wayland-service-type is instantiated so we ;; can depend on the Shepherd 'wayland-display' service. (service-extension home-wayland-service-type (const #t)))) (default-value (home-swaynotificationcenter-configuration)) (description "Run swaynotificationcenter, a notification daemon"))) (home-environment ;; Below is the list of packages that will show up in your ;; Home profile, under ~/.guix-home/profile. ;; Can't find ;; firefox k9s kubectl steam turnstile ;; Won't build ;; avidemux ;; Unknown ;; which (packages (list adb adwaita-icon-theme bash bash-completion bat bc binutils ;; blueman ;; bluez brightnessctl ccache chathistorysync chrony clang cmake cmus curl darktable dolphin-emu dulcepan ;; dunst easytag emacs fastfetch ffmpeg file flatpak font-adwaita foot luca-factorio:factorio-sa gajim gammastep ;; gcc-toolchain gimp git git-delta glibc-locales go gparted greetd grim hicolor-icon-theme htop hut icecat imagemagick imv jq khal libreoffice librewolf matcha mercurial mpv mumble ncurses neomutt neovim network-manager network-manager-applet newsboat nmap nss-certs offlineimap3 obs passt password-store patchelf pavucontrol picom pinentry ;; pipewire podman profanity python-virtualenv qemu ranger ripgrep rsync runit rust rust-cargo seatd slurp swappy sway swayidle ;; Must be installed system-wide, as it relies on PAM/suid ;; swaylock swaysome swayrbar swayr thunar tmux toot torsocks transmission tree-sitter-bash tree-sitter-c tree-sitter-c-sharp tree-sitter-cpp tree-sitter-css tree-sitter-go tree-sitter-html tree-sitter-javascript tree-sitter-json tree-sitter-lua tree-sitter-markdown tree-sitter-org tree-sitter-php tree-sitter-python tree-sitter-rust tree-sitter-scheme tree-sitter-typescript ungoogled-chromium unzip vim vsv w3m wayvnc weechat wl-clipboard wl-gammactl wofi wtype wvkbd xdg-utils yt-dlp ytfzf zathura zathura-pdf-mupdf zip zstd)) ;; 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 (bashrc (list (local-file ".bashrc" "bashrc"))) ;; TODO: Is it correct to use .profile as .bash_profile? (bash-profile (list (local-file ".profile" "profile"))) (bash-logout (list (local-file ".bash_logout" "bash_logout"))))) (simple-service 'additional-fonts-service home-fontconfig-service-type (list "~/.local/share/fonts")) (simple-service 'sourcing-profile home-shell-profile-service-type (list (local-file ".profile" "-profile"))) (service home-gpg-agent-service-type (home-gpg-agent-configuration (ssh-support? #f))) (service home-mcron-service-type (home-mcron-configuration (jobs (list #~(job '(next-hour) (lambda () (system* "offlineimap"))))))) (service home-ssh-agent-service-type) (service home-openssh-service-type (home-openssh-configuration (add-keys-to-agent "yes"))) (service home-dbus-service-type) (service home-pipewire-service-type) (service home-wayland-service-type) (service home-matcha-service-type (home-matcha-configuration (start-off #t))) (service home-wvkbd-service-type (home-wvkbd-configuration (start-hidden #t) (landscape-height 400) (font "ProtoNerdFontPropo 32"))) ;; (service home-dunst-service-type) (service home-swaynotificationcenter-service-type) (service home-files-service-type ;; Go through all relevant files in this repo and add them as symlinks individually ;; This is not done using local-file's recurse option in particular because ;; some services add their own files to .config, and there ;; will be conflicts if one service wants ;; .config/fontconfig/fonts.conf while we eat up the whole .config (map (lambda (name) `(,name ,(local-file (assume-source-relative-file-name name) ;; objects cannot have "." or "/" ;; in their name, so these must ;; be explicitely substituted (string-replace-substring (string-replace-substring name "." "-") "/" "-") #:recursive? #t))) ;; The given folders and files we want from the repo (append (find-files "./.config" file-not-symlink-check) (find-files "./.local" file-not-symlink-check) (list ".xinitrc" ".inputrc" ".tcshrc")))))))