users#nrd: fix gpg-agent not working

This commit is contained in:
Timothy DeHerrera 2019-12-15 21:22:09 -07:00
parent 6139834a4a
commit 87ab45c554
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122

View file

@ -1,7 +1,8 @@
{ lib, ... }: { config, lib, pkgs, ... }:
let let
inherit (builtins) inherit (builtins)
toFile toFile
readFile
; ;
inherit (lib) inherit (lib)
@ -11,12 +12,24 @@ let
name = "Timothy DeHerrera"; name = "Timothy DeHerrera";
gpgEnableSsh = true;
in in
{ {
imports = [ imports = [
../profiles/develop ../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-manager.users.nrd = {
home = { home = {
packages = mkForce []; packages = mkForce [];
@ -70,10 +83,10 @@ in
matchBlocks = let matchBlocks = let
githubKey = toFile "github" githubKey = toFile "github"
(fileContents ../secrets/github); (readFile ../secrets/github);
gitlabKey = toFile "gitlab" gitlabKey = toFile "gitlab"
(fileContents ../secrets/gitlab); (readFile ../secrets/gitlab);
in in
{ {
github = { github = {
@ -106,8 +119,10 @@ in
maxCacheTtl = 1800; maxCacheTtl = 1800;
defaultCacheTtlSsh = 60480000; defaultCacheTtlSsh = 60480000;
maxCacheTtlSsh = 60480000; maxCacheTtlSsh = 60480000;
enableSshSupport = true; enableSshSupport = gpgEnableSsh;
grabKeyboardAndMouse = true; extraConfig = ''
pinentry-program ${pkgs.pinentry.curses}/bin/pinentry-curses
'';
}; };
}; };