diff options
Diffstat (limited to 'users/ryan/linux/guix.nix')
| -rw-r--r-- | users/ryan/linux/guix.nix | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/users/ryan/linux/guix.nix b/users/ryan/linux/guix.nix new file mode 100644 index 0000000..acee0f3 --- /dev/null +++ b/users/ryan/linux/guix.nix | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | { pkgs, inputs, ... }: | ||
| 2 | |||
| 3 | # Workarounds specific to running home-manager on top of Guix System (as | ||
| 4 | # opposed to NixOS, or some other foreign distro). Keep this narrow - | ||
| 5 | # anything that would also apply to e.g. WSL belongs in ./foreign.nix | ||
| 6 | # instead. | ||
| 7 | { | ||
| 8 | # Guix doesn't run a systemd user session the way home-manager expects, | ||
| 9 | # so activation shouldn't try to start/restart systemd user units. | ||
| 10 | systemd.user.startServices = false; | ||
| 11 | |||
| 12 | # Guix Home's login shell (bash, via /etc/passwd) sources ~/.bash_profile | ||
| 13 | # -> ~/.profile, which runs ~/.guix-home/setup-environment and | ||
| 14 | # ~/.guix-home/on-first-login. The latter is what actually starts this | ||
| 15 | # user's shepherd instance (which manages pipewire/pulseaudio and other | ||
| 16 | # home services) if it isn't running yet. zsh has no equivalent of | ||
| 17 | # ~/.profile, so with zsh as the login shell that chain never runs and | ||
| 18 | # shepherd (and anything it starts, e.g. audio) never comes up. Replicate | ||
| 19 | # it in .zprofile, which - like .bash_profile - only runs for login shells. | ||
| 20 | programs.zsh.profileExtra = '' | ||
| 21 | if [ -f "$HOME/.guix-home/setup-environment" ]; then | ||
| 22 | HOME_ENVIRONMENT="$HOME/.guix-home" | ||
| 23 | . "$HOME_ENVIRONMENT/setup-environment" | ||
| 24 | "$HOME_ENVIRONMENT/on-first-login" | ||
| 25 | unset HOME_ENVIRONMENT | ||
| 26 | fi | ||
| 27 | ''; | ||
| 28 | |||
| 29 | # gtk3.nix (see ../linux.nix's gtk.* config) mirrors GTK settings into | ||
| 30 | # dconf, which needs a session D-Bus during activation. This host has no | ||
| 31 | # /etc/dbus-1/session.conf and no session bus running at switch time, so | ||
| 32 | # dconf's dbus-run-session activation step fails. GTK is still themed via | ||
| 33 | # gtk-3.0/gtk-4.0 settings.ini; dconf mainly matters for GNOME/libadwaita | ||
| 34 | # apps, which aren't in play here. | ||
| 35 | dconf.enable = false; | ||
| 36 | |||
| 37 | # Guix Home used to run gpg-agent as a shepherd service and export | ||
| 38 | # SSH_AUTH_SOCK into the whole session before Hyprland started. That | ||
| 39 | # service is disabled now, and zsh's SSH_AUTH_SOCK export (see | ||
| 40 | # programs.zsh in common.nix) only reaches shells, not apps Hyprland | ||
| 41 | # spawns directly - so launch the agent and push the socket path into | ||
| 42 | # Hyprland's own env here instead. A NixOS host would have a real | ||
| 43 | # systemd --user session doing this via gpg-agent.socket activation, | ||
| 44 | # so this only belongs on Guix. | ||
| 45 | wayland.windowManager.hyprland.extraConfig = '' | ||
| 46 | exec-once = sh -c 'gpgconf --launch gpg-agent; hyprctl setenv SSH_AUTH_SOCK "$(gpgconf --list-dirs agent-ssh-socket)"' | ||
| 47 | ''; | ||
| 48 | |||
| 49 | # base-system.scm enables pcscd-service-type, so pcscd already owns the | ||
| 50 | # Yubikey's USB CCID interface. scdaemon's internal libusb CCID driver | ||
| 51 | # then fails to open the device (`ccid open error: skip`) and doesn't | ||
| 52 | # fall back to PC/SC on its own, so `gpg --card-status`/`--edit-card` | ||
| 53 | # report "No such device". Force scdaemon through pcscd instead. A NixOS | ||
| 54 | # host would only need this if it also runs services.pcscd itself. | ||
| 55 | programs.gpg.scdaemonSettings.disable-ccid = true; | ||
| 56 | |||
| 57 | home.packages = [ | ||
| 58 | # hyprlock built by nix needs Guix's PAM libs preloaded to authenticate | ||
| 59 | # against Guix's PAM stack. Don't also preload Guix's libfontconfig.so | ||
| 60 | # here: it's a "fontconfig-minimal" build that lacks symbols (e.g. | ||
| 61 | # FcConfigSetDefaultSubstitute) which nix's pango expects, causing a | ||
| 62 | # symbol lookup error at startup. Let hyprlock use nix's own fontconfig | ||
| 63 | # from its normal closure instead. | ||
| 64 | (pkgs.writeScriptBin "hyprlock" '' | ||
| 65 | #! ${pkgs.bash}/bin/bash | ||
| 66 | export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:$LD_PRELOAD" | ||
| 67 | exec ${pkgs.hyprlock}/bin/hyprlock "$@" | ||
| 68 | '') | ||
| 69 | |||
| 70 | # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL. | ||
| 71 | inputs.nixgl.packages.${pkgs.stdenv.hostPlatform.system}.nixGLIntel | ||
| 72 | ]; | ||
| 73 | } | ||
