a decent working guix config

This commit is contained in:
Chris Cochrun 2023-06-23 10:02:12 -05:00
parent ae77d05e2f
commit 0ebbec7644
22 changed files with 2302 additions and 279 deletions

View file

@ -2,8 +2,9 @@
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
"654fcf9971bb01389d577be07c6ec0f68940c743")
;; (commit
;; "654fcf9971bb01389d577be07c6ec0f68940c743")
(commit "d884fc9e2efecfba09af4694f5a13ad7fc6f704f")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
@ -13,8 +14,9 @@
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
(branch "master")
(commit
"c323f4c866cdf7c9fb958ed968b80e0911ecd899")
;; (commit
;; "c323f4c866cdf7c9fb958ed968b80e0911ecd899")
(commit "bf13c6b5f32980582e8c19b509c6825e86b953dd")
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
@ -22,10 +24,27 @@
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
(channel
(name 'rosenthal)
(url "https://github.com/rakino/rosenthal")
(url "https://codeberg.org/hako/rosenthal.git")
(branch "trunk")
(introduction
(make-channel-introduction
"7677db76330121a901604dfbad19077893865f35"
(openpgp-fingerprint
"13E7 6CD6 E649 C28C 3385 4DF5 5E5A A665 6149 17F7")))))
"13E7 6CD6 E649 C28C 3385 4DF5 5E5A A665 6149 17F7"))))
(channel
(name 'rde)
(url "https://git.sr.ht/~abcdw/rde")
(introduction
(make-channel-introduction
"257cebd587b66e4d865b3537a9a88cccd7107c95"
(openpgp-fingerprint
"2841 9AC6 5038 7440 C7E9 2FFA 2208 D209 58C1 DEB0"))))
;; (channel
;; (name 'emacs)
;; (url "https://github.com/babariviere/guix-emacs")
;; (introduction
;; (make-channel-introduction
;; "72ca4ef5b572fea10a4589c37264fa35d4564783"
;; (openpgp-fingerprint
;; "261C A284 3452 FB01 F6DF 6CF4 F9B7 864F 2AB4 6F18"))))
)

View file

@ -0,0 +1,99 @@
(define-module (home-services pipewire)
#:use-module (gnu packages)
#:use-module (gnu packages linux)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (guix gexp))
(define (home-pipewire-profile-service config)
(map specification->package
(list "pipewire"
"wireplumber")))
(define (home-pipewire-shepherd-service config)
(list
;; Start Pipewire daemon
(shepherd-service
(requirement '(dbus))
(provision '(pipewire))
(stop #~(make-kill-destructor))
(start #~(make-forkexec-constructor
(list #$(file-append pipewire "/bin/pipewire"))
#:log-file (string-append
(or (getenv "XDG_LOG_HOME")
(format #f "~a/.local/var/log"
(getenv "HOME")))
"/pipewire.log")
#:environment-variables
(append (list "DISABLE_RTKIT=1")
(default-environment-variables)))))
;; Start Pipewire PulseAudio module
(shepherd-service
(requirement '(pipewire))
(provision '(pipewire-pulse))
(stop #~(make-kill-destructor))
(start #~(make-forkexec-constructor
(list #$(file-append pipewire "/bin/pipewire-pulse"))
#:log-file (string-append
(or (getenv "XDG_LOG_HOME")
(format #f "~a/.local/var/log"
(getenv "HOME")))
"/pipewire-pulse.log")
#:environment-variables
(append (list "DISABLE_RTKIT=1")
(default-environment-variables)))))
;; Start Wireplumber session manager
(shepherd-service
(requirement '(pipewire))
(provision '(wireplumber))
(stop #~(make-kill-destructor))
(start #~(make-forkexec-constructor
(list #$(file-append wireplumber "/bin/wireplumber"))
#:log-file (string-append
(or (getenv "XDG_LOG_HOME")
(format #f "~a/.local/var/log"
(getenv "HOME")))
"/wireplumber.log")
#:environment-variables
(append (list "DISABLE_RTKIT=1")
(default-environment-variables)))))))
(define (home-pipewire-xdg-configuration-service config)
`(("alsa/asoundrc"
,(mixed-text-file
"asoundrc"
#~(string-append
"<"
#$(file-append
pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf")
">\n<"
#$(file-append
pipewire "/share/alsa/alsa.conf.d/99-pipewire-default.conf")
">\n"
"
pcm_type.pipewire {
lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_pcm_pipewire.so")
"
}
ctl_type.pipewire {
lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so")
"
}
")))))
(define-public home-pipewire-service-type
(service-type (name 'home-pipewire)
(extensions
(list (service-extension
home-profile-service-type
home-pipewire-profile-service)
(service-extension
home-shepherd-service-type
home-pipewire-shepherd-service)
(service-extension
home-xdg-configuration-files-service-type
home-pipewire-xdg-configuration-service)))
(default-value #f)
(description "Configures and runs the Pipewire audio system.")))

View file

@ -0,0 +1,32 @@
(define-module (home-services udiskie)
#:use-module (gnu services)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu packages freedesktop)
#:use-module (gnu services configuration)
#:use-module (guix gexp)
#:export (home-udiskie-service-type))
(define (home-udiskie-profile-service config)
(list udiskie))
(define (home-udiskie-shepherd-service config)
(list
(shepherd-service
(provision '(udiskie))
(documentation "Run and control udiskie.")
(start #~(make-forkexec-constructor '("udiskie" "-t")))
(stop #~(make-kill-destructor)))))
(define home-udiskie-service-type
(service-type (name 'home-udiskie)
(description "A service for launching Udiskie.")
(extensions
(list (service-extension
home-profile-service-type
home-udiskie-profile-service)
(service-extension
home-shepherd-service-type
home-udiskie-shepherd-service)))
(default-value #f)))

15
guix/home.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, pkgs, ... }:
{
home.username = "chris";
home.homeDirectory = "/home/chris";
home.stateVersion = "23.05";
programs.home-manager.enable = true;
home.packages = with pkgs; [
eww-wayland
swww
starship
# The guix version of dolphin isn't built for wayland and can't find the icon theme
dolphin
];
}

View file

@ -4,34 +4,136 @@
;; need to capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.
(use-modules (gnu home)
(gnu home services)
(gnu packages)
(gnu packages vim)
(gnu packages rust-apps)
(gnu packages video)
(gnu services)
(guix gexp)
(gnu home services shells))
(define-module (home)
#:use-module (home-services pipewire)
#:use-module (gnu home)
#:use-module (gnu home services)
#:use-module (gnu home services desktop)
#:use-module (gnu home services shells)
#:use-module (gnu home services xdg)
#:use-module (gnu home services gnupg)
#:use-module (gnu packages)
#:use-module (gnu packages vim)
#:use-module (gnu packages rust-apps)
#:use-module (gnu packages video)
#:use-module (gnu packages gnupg)
#:use-module (gnu services)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system emacs)
#:use-module ((guix licenses) #:prefix license:))
;; (define home-scripts
;; (package
;; (name "home-scripts")
;; (version "0.1")
;; (source (local-file "../scripts" #:recursive #t))
;; (build-system copy-build-system)
;; (arguments
;; `(#:install-plan
;; '(())))))
(define emacs-dired-rsync
(let ((commit "c4f484bff94ed2ddfe0fa45f1e695a1637e1a35a")
(revision "0"))
(package
(name "emacs-dired-rsync")
(version (git-version "0.0.1" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/stsquad/dired-rsync.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0000000000000000000000000000000000000000000000000000"))))
(build-system emacs-build-system)
(arguments (list #:emacs emacs-next-pgtk))
(license license:gpl3+)
(home-page "https://github.com/stsquad/dired-rsync.git")
(synopsis "dired-rsync asynchronous rsync from dired")
(description "\
This package adds the command dired-rsync which allows the user to copy
marked files in a dired buffer via rsync."))))
(home-environment
;; Below is the list of packages that will show up in your
;; Home profile, under ~/.guix-home/profile.
(packages (specifications->packages (list "vim"
"exa"
"unzip"
"rsync"
"openssh"
"gcc-toolchain"
"make"
"curl"
"mpv"
"mpv-mpris"
"yt-dlp"
"tmux"
"direnv"
"dutree"
"btop"
"htop"
"ripgrep"
"alacritty"
"libnotify"
"nextcloud-client"
"rofi-wayland"
"waybar"
"qt5ct"
"fd"
"bc"
"sysstat"
"ffmpeg"
"dolphin"
"pandoc"
"grim"
"slurp"
"imv"
"openjdk"
;; "dolphin"
"kwallet"
"kwallet-pam"
"breeze"
"breeze-icons"
"kdeconnect"
"pinentry"
"pinentry-qt"
"pinentry-gnome3"
"pinentry-rofi"
"pulsemixer"
"python-pulsectl"
"dunst"
"rbw"
"aspell"
"aspell-dict-en"
"alsa-utils"
"lightly"
"swaylock-effects"
"swayidle"
"wtype"
"brightnessctl"
"flatpak"
"flatpak-xdg-utils"
"xdg-utils"
"xdg-desktop-portal"
"xdg-desktop-portal-kde"
"papirus-icon-theme"
"font-google-noto"
"font-google-noto-emoji"
"enchant"
"blesh"
"ncurses"
"emacs-next-pgtk"
"emacs-dired-rsync"
"emacs-all-the-icons"
"emacs-org-roam"
"emacs-paredit"
"emacs-evil-paredit"
"emacs-doom-modeline"
"emacs-doom-themes"
"emacs-org"
@ -52,6 +154,7 @@
"emacs-evil-surround"
"emacs-websocket"
"emacs-org-modern"
"emacs-org-web-tools"
"emacs-org-re-reveal"
"emacs-emojify"
"emacs-pulsar"
@ -97,13 +200,84 @@
(home-bash-configuration
(guix-defaults? #t)
(aliases '(("grep" . "grep --color=auto")
("ll" . "ls -l")
("ls" . "exa -l")
("la" . "exa -la")))))
("gh" . "guix home reconfigure ~/dotfiles/guix/home.scm")
("gs" . "guix system reconfigure ~/dotfiles/guix/system.scm")))
(environment-variables
'(("QT_QPA_PLATFORM" . "wayland")
("QT_QPA_PLATFORMTHEME" . "qt5ct")))
(bashrc (list (plain-file "blesh" "source .guix-home/profile/share/blesh/ble.sh")
(plain-file "home-manager" "source .nix-profile/etc/profile.d/hm-session-vars.sh")
;;These need to be here so they are at the bottom and therefore after guix-defaults
(plain-file "exal" "alias ls=\"exa -l\"")
(plain-file "exala" "alias la=\"exa -la\"")
(plain-file "less-color" "export LESS=\"--RAW-CONTROL-CHARS\"")
(plain-file "man-colors" "[[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP")
(plain-file "starship" "source .config/starship/init.sh")))))
(simple-service 'extra-env-vars
home-environment-variables-service-type
`(("PATH" . "$PATH:/home/chris/bin:/home/chris/.nix-profile/bin")
("QT_QPA_PLATFORM" . "wayland")
("QT_QPA_PLATFORMTHEME" . "qt5ct")
("LITERAL_VALUE" . ,(literal-string "${abc}"))))
(service home-fish-service-type
(home-fish-configuration
(aliases '(("ls" . "exa -l")
("gh" . "guix home reconfigure ~/.files/guix/home.scm")))))
(service home-xdg-configuration-files-service-type
`(("hypr/hyprland.conf" ,(local-file "../.config/hypr/hyprland.conf"))
("alacritty/alacritty.yml" ,(local-file "../.config/alacritty/alacritty.yml")))))))
("gh" . "guix home reconfigure ~/dotfiles/guix/home.scm")
("gs" . "guix system reconfigure ~/dotfiles/guix/system.scm")))))
(simple-service 'config
home-xdg-configuration-files-service-type
`(("hypr" ,(local-file "../.config/hypr" #:recursive? #t))
("tridactyl" ,(local-file "../.config/tridactyl" #:recursive? #t))
("eww" ,(local-file "../.config/eww" #:recursive? #t))
("waybar" ,(local-file "../.config/waybar" #:recursive? #t))
("rofi" ,(local-file "../.config/rofi" #:recursive? #t))
("dunst" ,(local-file "../.config/dunst" #:recursive? #t))
("btop" ,(local-file "../.config/bpytop" #:recursive? #t))
("mpv" ,(local-file "../.config/mpv" #:recursive? #t))
("blesh" ,(local-file "../.config/blesh" #:recursive? #t))
("starship" ,(local-file "../.config/starship" #:recursive? #t))
("starship.toml" ,(local-file "../.config/starship.toml"))
("guix/channels.scm" ,(local-file "channels.scm"))
("home-manager/home.nix" ,(local-file "home.nix"))
("qt5ct/colors/snazzy.conf" ,(local-file "../.config/qt5ct/snazzy.conf"))
("alacritty/alacritty.yml" ,(local-file "../.config/alacritty/alacritty.yml"))))
(simple-service 'scripts
home-files-service-type
`(("bin" ,(local-file "../scripts" #:recursive? #t))
(".mozilla/firefox/chris.default/chrome" ,(local-file "../.config/firefox/chrome" #:recursive? #t))))
(service home-gpg-agent-service-type
(home-gpg-agent-configuration
(pinentry-program
(file-append pinentry-rofi "/bin/pinentry-rofi"))
(ssh-support? #t)
(default-cache-ttl 28800)
(max-cache-ttl 28800)
(default-cache-ttl-ssh 28800)
(max-cache-ttl-ssh 28800)))
(service home-xdg-user-directories-service-type
(home-xdg-user-directories-configuration
(videos "$HOME/vids")
(pictures "$HOME/pics")
(download "$HOME/dls")
(documents "$HOME/docs")
(music "$HOME/music")
(templates "$HOME")
(desktop "$HOME")
(publicshare "$HOME")))
(service home-xdg-mime-applications-service-type
(home-xdg-mime-applications-configuration
(default '(("video/mp4" . "mpv.desktop")
("video/webm" . "mpv.desktop")
("video/x-matroska" . "mpv.destop")
("audio/opus" . "mpv-slow.desktop")))
(desktop-entries
(list (xdg-desktop-entry
(file "mpv-slow")
(name "MPV for Audio and Streams")
(type 'application)
(config
'((exec . "mpv --profile=slow %U"))))))))
(service home-pipewire-service-type)
(service home-dbus-service-type))))

@ -1 +0,0 @@
Subproject commit dd7519aa20948e42469eccc3c7c99c1633420a07

View file

@ -10,14 +10,54 @@
;; Indicate which modules to import to access the variables
;; used in this configuration.
(use-modules (gnu)
(gnu services)
(gnu services shepherd)
(gnu services dbus)
(gnu system)
(gnu system setuid)
(gnu system nss)
(rosenthal packages wm)
(nongnu packages linux)
(nongnu system linux-initrd))
(use-service-modules cups desktop networking ssh xorg)
(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 my-desktop-services
(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)))
(operating-system
(kernel linux)
(initrd microcode-initrd)
(firmware (list linux-firmware))
(kernel linux)
(initrd microcode-initrd)
(firmware (list linux-firmware))
(locale "en_US.utf8")
(timezone "America/Chicago")
(keyboard-layout (keyboard-layout "us"))
@ -25,49 +65,126 @@
;; 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" "audio" "video")))
(name "chris")
(comment "Chris")
(group "users")
(home-directory "/home/chris")
(supplementary-groups '("wheel" "netdev" "tty" "audio" "video")))
%base-user-accounts))
(sudoers-file etc-sudoers-config)
;; Packages installed system-wide. Users can also install packages
;; under their own account: use 'guix search KEYWORD' to search
;; for packages and 'guix install PACKAGE' to install a package.
(packages (append (list (specification->package "nss-certs")
(specification->package "sway")
(specification->package "dbus-glib")
(specification->package "hyprland")
(specification->package "emacs-next-pgtk"))
%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)
(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))))
;; To configure OpenSSH, pass an 'openssh-configuration'
;; record as a second argument to 'service' below.
(service openssh-service-type)
(service cups-service-type)
(set-xorg-configuration
(xorg-configuration (keyboard-layout keyboard-layout))))
(simple-service 'mtp udev-service-type (list libmtp))
(udev-rules-service 'pipewire-add-udev-rules pipewire)
(udev-rules-service 'brightnessctl-udev-rules brightnessctl)
;; This is the default list of services we
;; are appending to.
(modify-services %desktop-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)))))))
(service nix-service-type)
(service thermald-service-type)
(service tlp-service-type
(tlp-configuration
(cpu-boost-on-ac? #t)
(wifi-pwr-on-bat? #t)))
(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))
my-desktop-services))
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(targets (list "/boot/efi"))
(keyboard-layout keyboard-layout)))
(bootloader grub-efi-bootloader)
(targets (list "/boot/efi"))
(keyboard-layout keyboard-layout)))
;; The list of file systems that get "mounted". The unique
;; file system identifiers there ("UUIDs") can be obtained