Skip to content

Commit

Permalink
Add pinentry-wsl to home-manager config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
timraymond committed Dec 11, 2024
1 parent cf57a63 commit f52948a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
11 changes: 8 additions & 3 deletions home/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@

services = lib.mkMerge [
{
gpg-agent = {
gpg-agent = let
day = 86400;
in {
enable = true;
defaultCacheTtl = 1800;
pinentryPackage = pkgs.pinentry-curses;
defaultCacheTtl = 1 * day;
defaultCacheTtlSsh = 1 * day;
maxCacheTtl = 30 * day;
maxCacheTtlSsh = 30 * day;
pinentryPackage = pkgs.pinentry-wsl;
enableSshSupport = true;
};
}
Expand Down
23 changes: 23 additions & 0 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,27 @@ final: prev: {
sha256 = "1ouXcJHWhX7vPuOa27kPT+49cBTFB4n3HZ/LwE+12aw=";
};
};

pinentry-wsl = prev.stdenv.mkDerivation {
pname = "pinentry-wsl";
version = "41c6ea1";
meta = {
mainProgram = "pinentry-wsl-ps1.sh";
};
src = prev.fetchFromGitHub {
owner = "diablodale";
repo = "pinentry-wsl-ps1";
rev = "4fc6ea16270c9c2f2d9daeae1ba4aa0d868d1b2a";
sha256 = "sha256-nAK3GwVYOOghFVf9Yj5zFOcVeFfSsW5fHy6rfH+edAs=";
};
buildInputs = [ prev.bash ];
nativeBuildInputs = [ prev.makeWrapper ];
installPhase = ''
mkdir -p $out/bin
chmod +x pinentry-wsl-ps1.sh
cp pinentry-wsl-ps1.sh $out/bin/pinentry-wsl-ps1.sh
wrapProgram $out/bin/pinentry-wsl-ps1.sh \
--prefix PATH : ${prev.lib.makeBinPath [ prev.bash ]}
'';
};
}

0 comments on commit f52948a

Please sign in to comment.