1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-10 21:29:48 +01:00

gpg-agent: add nushell integration

This commit is contained in:
TornaxO7 2023-11-25 16:56:07 +01:00 committed by Mikilio
parent 91b4c632e6
commit 07a186f6b9
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

View file

@ -22,6 +22,16 @@ let
set -gx GPG_TTY (tty) set -gx GPG_TTY (tty)
'' + optionalString cfg.enableSshSupport gpgSshSupportStr; '' + optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgNushellInitStr = ''
$env.GPG_TTY = (tty)
'' + optionalString cfg.enableSshSupport ''
${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye | ignore
if not "SSH_AUTH_SOCK" in $env {
$env.SSH_AUTH_SOCK = (${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)
}
'';
# mimic `gpgconf` output for use in `systemd` unit definitions. # mimic `gpgconf` output for use in `systemd` unit definitions.
# we cannot use `gpgconf` directly because it heavily depends on system # we cannot use `gpgconf` directly because it heavily depends on system
# state, but we need the values at build time. original: # state, but we need the values at build time. original:
@ -216,6 +226,10 @@ in {
enableFishIntegration = mkEnableOption "Fish integration" // { enableFishIntegration = mkEnableOption "Fish integration" // {
default = true; default = true;
}; };
enableNushellIntegration = mkEnableOption "Nushell integration" // {
default = true;
};
}; };
}; };
@ -247,6 +261,9 @@ in {
programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr; programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr;
programs.fish.interactiveShellInit = programs.fish.interactiveShellInit =
mkIf cfg.enableFishIntegration gpgFishInitStr; mkIf cfg.enableFishIntegration gpgFishInitStr;
programs.nushell.extraEnv =
mkIf cfg.enableNushellIntegration gpgNushellInitStr;
} }
(mkIf (cfg.sshKeys != null) { (mkIf (cfg.sshKeys != null) {