summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2026-08-24 01:24:20 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2026-08-24 01:24:20 -0400
commit181f59e7219fa3cfed36c05773ac6a8dc40e5571 (patch)
tree6e119eb9858b6e72e1b54420bbda230e675d394d
parentcabf188ae487120d4b9ac1fe21fff45403a787b4 (diff)
ssh fix in guix
-rw-r--r--users/ryan/linux/guix.nix55
1 files changed, 14 insertions, 41 deletions
diff --git a/users/ryan/linux/guix.nix b/users/ryan/linux/guix.nix
index acee0f3..65e7053 100644
--- a/users/ryan/linux/guix.nix
+++ b/users/ryan/linux/guix.nix
@@ -1,22 +1,8 @@
1{ pkgs, inputs, ... }: 1{ pkgs, lib, inputs, ... }:
2 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{ 3{
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; 4 systemd.user.startServices = false;
11 5
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 = '' 6 programs.zsh.profileExtra = ''
21 if [ -f "$HOME/.guix-home/setup-environment" ]; then 7 if [ -f "$HOME/.guix-home/setup-environment" ]; then
22 HOME_ENVIRONMENT="$HOME/.guix-home" 8 HOME_ENVIRONMENT="$HOME/.guix-home"
@@ -26,41 +12,15 @@
26 fi 12 fi
27 ''; 13 '';
28 14
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; 15 dconf.enable = false;
36 16
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 = '' 17 wayland.windowManager.hyprland.extraConfig = ''
46 exec-once = sh -c 'gpgconf --launch gpg-agent; hyprctl setenv SSH_AUTH_SOCK "$(gpgconf --list-dirs agent-ssh-socket)"' 18 exec-once = sh -c 'gpgconf --launch gpg-agent; hyprctl setenv SSH_AUTH_SOCK "$(gpgconf --list-dirs agent-ssh-socket)"'
47 ''; 19 '';
48 20
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; 21 programs.gpg.scdaemonSettings.disable-ccid = true;
56 22
57 home.packages = [ 23 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" '' 24 (pkgs.writeScriptBin "hyprlock" ''
65 #! ${pkgs.bash}/bin/bash 25 #! ${pkgs.bash}/bin/bash
66 export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:$LD_PRELOAD" 26 export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:$LD_PRELOAD"
@@ -70,4 +30,17 @@
70 # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL. 30 # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL.
71 inputs.nixgl.packages.${pkgs.stdenv.hostPlatform.system}.nixGLIntel 31 inputs.nixgl.packages.${pkgs.stdenv.hostPlatform.system}.nixGLIntel
72 ]; 32 ];
33
34 # We need to correct the ssh config file's permissions on guix
35 # Remove the symlink and just install the store file directly
36 home.activation = {
37 fixSshPermissions = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
38 run install -d -m 0700 "$HOME/.ssh"
39 if [ -L "$HOME/.ssh/config" ]; then
40 src="$(readlink -f "$HOME/.ssh/config")"
41 run rm -f "$HOME/.ssh/config"
42 run install -m 0600 "$src" "$HOME/.ssh/config"
43 fi
44 '';
45 };
73} 46}