0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

nixos/{budgie,cinnamon,mate}: Hack around SSH_AUTH_SOCK

Make sure SSH_AUTH_SOCK is known by these sessions, which are not
systemd managed. It should not be a problem for users who know this
environment variable and use multiple desktops environments to
opt-out of this and I would prefer a more out-of-the-box experience
for those who don't.
This commit is contained in:
Bobby Rong 2025-06-15 13:17:46 +08:00
parent c5797e8556
commit cf39ba5e07
No known key found for this signature in database
3 changed files with 44 additions and 20 deletions

View file

@ -130,17 +130,25 @@ in
services.xserver.desktopManager.budgie.sessionPath = [ pkgs.budgie-desktop-view ];
environment.extraInit = ''
${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
environment.extraInit =
''
${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
fi
if [ -d "${p}/lib/girepository-1.0" ]; then
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
fi
'') cfg.sessionPath}
''
+ lib.optionalString config.services.gnome.gcr-ssh-agent.enable ''
# Hack: https://bugzilla.redhat.com/show_bug.cgi?id=2250704 still
# applies to sessions not managed by systemd.
if [ -z "$SSH_AUTH_SOCK" ] && [ -n "$XDG_RUNTIME_DIR" ]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"
fi
if [ -d "${p}/lib/girepository-1.0" ]; then
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
fi
'') cfg.sessionPath}
'';
'';
environment.systemPackages =
with pkgs;

View file

@ -87,18 +87,26 @@ in
};
# Have to take care of GDM + Cinnamon on Wayland users
environment.extraInit = ''
${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
fi
environment.extraInit =
''
${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
fi
if [ -d "${p}/lib/girepository-1.0" ]; then
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
if [ -d "${p}/lib/girepository-1.0" ]; then
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
fi
'') cfg.sessionPath}
''
+ lib.optionalString config.services.gnome.gcr-ssh-agent.enable ''
# Hack: https://bugzilla.redhat.com/show_bug.cgi?id=2250704 still
# applies to sessions not managed by systemd.
if [ -z "$SSH_AUTH_SOCK" ] && [ -n "$XDG_RUNTIME_DIR" ]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"
fi
'') cfg.sessionPath}
'';
'';
# Default services
services.blueman.enable = mkDefault (notExcluded pkgs.blueman);

View file

@ -59,6 +59,14 @@ in
pkgs.mate.mate-session-manager
];
environment.extraInit = lib.optionalString config.services.gnome.gcr-ssh-agent.enable ''
# Hack: https://bugzilla.redhat.com/show_bug.cgi?id=2250704 still
# applies to sessions not managed by systemd.
if [ -z "$SSH_AUTH_SOCK" ] && [ -n "$XDG_RUNTIME_DIR" ]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"
fi
'';
# Debugging
environment.sessionVariables.MATE_SESSION_DEBUG = mkIf cfg.debug "1";