Skip to content

Commit f52948a

Browse files
committed
Add pinentry-wsl to home-manager config
This uses the pinentry-wsl script to use Windows's credential store instead of the curses one. This has better integration, so that things like vim-fugitive will work with it.
1 parent cf57a63 commit f52948a

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

home/default.nix

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@
5353

5454
services = lib.mkMerge [
5555
{
56-
gpg-agent = {
56+
gpg-agent = let
57+
day = 86400;
58+
in {
5759
enable = true;
58-
defaultCacheTtl = 1800;
59-
pinentryPackage = pkgs.pinentry-curses;
60+
defaultCacheTtl = 1 * day;
61+
defaultCacheTtlSsh = 1 * day;
62+
maxCacheTtl = 30 * day;
63+
maxCacheTtlSsh = 30 * day;
64+
pinentryPackage = pkgs.pinentry-wsl;
6065
enableSshSupport = true;
6166
};
6267
}

overlays/default.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,27 @@ final: prev: {
4242
sha256 = "1ouXcJHWhX7vPuOa27kPT+49cBTFB4n3HZ/LwE+12aw=";
4343
};
4444
};
45+
46+
pinentry-wsl = prev.stdenv.mkDerivation {
47+
pname = "pinentry-wsl";
48+
version = "41c6ea1";
49+
meta = {
50+
mainProgram = "pinentry-wsl-ps1.sh";
51+
};
52+
src = prev.fetchFromGitHub {
53+
owner = "diablodale";
54+
repo = "pinentry-wsl-ps1";
55+
rev = "4fc6ea16270c9c2f2d9daeae1ba4aa0d868d1b2a";
56+
sha256 = "sha256-nAK3GwVYOOghFVf9Yj5zFOcVeFfSsW5fHy6rfH+edAs=";
57+
};
58+
buildInputs = [ prev.bash ];
59+
nativeBuildInputs = [ prev.makeWrapper ];
60+
installPhase = ''
61+
mkdir -p $out/bin
62+
chmod +x pinentry-wsl-ps1.sh
63+
cp pinentry-wsl-ps1.sh $out/bin/pinentry-wsl-ps1.sh
64+
wrapProgram $out/bin/pinentry-wsl-ps1.sh \
65+
--prefix PATH : ${prev.lib.makeBinPath [ prev.bash ]}
66+
'';
67+
};
4568
}

0 commit comments

Comments
 (0)