From 87ab45c5547d338502ca6ea5e16f439877bf63ff Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 15 Dec 2019 21:22:09 -0700 Subject: [PATCH] users#nrd: fix gpg-agent not working --- users/nrd.nix | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/users/nrd.nix b/users/nrd.nix index 64c6e589..498c7111 100644 --- a/users/nrd.nix +++ b/users/nrd.nix @@ -1,7 +1,8 @@ -{ lib, ... }: +{ config, lib, pkgs, ... }: let inherit (builtins) toFile + readFile ; inherit (lib) @@ -11,12 +12,24 @@ let name = "Timothy DeHerrera"; + + gpgEnableSsh = true; in { imports = [ ../profiles/develop ]; + environment.shellInit = '' + # gpg + export GPG_TTY="$(tty)" + '' + lib.optionalString gpgEnableSsh + "${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null"; + + environment.sessionVariables = { + SSH_AUTH_SOCK = "$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)"; + }; + home-manager.users.nrd = { home = { packages = mkForce []; @@ -70,10 +83,10 @@ in matchBlocks = let githubKey = toFile "github" - (fileContents ../secrets/github); + (readFile ../secrets/github); gitlabKey = toFile "gitlab" - (fileContents ../secrets/gitlab); + (readFile ../secrets/gitlab); in { github = { @@ -106,8 +119,10 @@ in maxCacheTtl = 1800; defaultCacheTtlSsh = 60480000; maxCacheTtlSsh = 60480000; - enableSshSupport = true; - grabKeyboardAndMouse = true; + enableSshSupport = gpgEnableSsh; + extraConfig = '' + pinentry-program ${pkgs.pinentry.curses}/bin/pinentry-curses + ''; }; };