From dfaa360dfef0cd0b77eb38d1cc5c3ff5f27ccf0d Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Fri, 12 Jan 2024 08:19:20 +0000 Subject: [PATCH] Switch to using pass-git-helper for https git auth Remove gitFull and associated secret-store auth save mechanism Also set default pinentry flavour to curses, but still set to gnome3 in hyprland setup - provides fall back for non-GUI interfaces --- home/accounts/git-pass-mapping.ini | 6 ++++++ home/accounts/pass.nix | 12 +++++++----- home/default.nix | 2 -- home/hyprland/default.nix | 1 + system/default.nix | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 home/accounts/git-pass-mapping.ini diff --git a/home/accounts/git-pass-mapping.ini b/home/accounts/git-pass-mapping.ini new file mode 100644 index 00000000..23e62394 --- /dev/null +++ b/home/accounts/git-pass-mapping.ini @@ -0,0 +1,6 @@ +[DEFAULT] +username_extractor=regex_search +regex_username=^login: (.*)$ + +[*] +target=git/${host} \ No newline at end of file diff --git a/home/accounts/pass.nix b/home/accounts/pass.nix index 872a3ae7..e5f87101 100644 --- a/home/accounts/pass.nix +++ b/home/accounts/pass.nix @@ -1,7 +1,6 @@ -{ config, pkgs, ... }: - -{ - home.packages = [ pkgs.pinentry ]; +{ config, lib, pkgs, ... }: { + xdg.configFile."pass-git-helper/git-pass-mapping.ini".source = + ./git-pass-mapping.ini; programs = { gpg.enable = true; password-store = { @@ -13,6 +12,9 @@ PASSWORD_STORE_ENABLE_EXTENSIONS = "true"; }; }; + git.extraConfig.credential = { + helper = "${pkgs.pass-git-helper}/bin/pass-git-helper"; + }; }; services = { gpg-agent = rec { @@ -20,7 +22,7 @@ maxCacheTtl = 86400; defaultCacheTtl = maxCacheTtl; defaultCacheTtlSsh = maxCacheTtl; - pinentryFlavor = "gnome3"; + pinentryFlavor = lib.mkDefault "curses"; extraConfig = '' no-allow-external-cache ''; diff --git a/home/default.nix b/home/default.nix index 874d3526..0d9a480b 100644 --- a/home/default.nix +++ b/home/default.nix @@ -70,7 +70,6 @@ }; git = { enable = true; - package = pkgs.gitFull; userName = "Evie Litherland-Smith"; userEmail = lib.mkDefault "evie@xenia.me.uk"; delta = { @@ -89,7 +88,6 @@ init.defaultBranch = "main"; merge.conflictstyle = "diff3"; diff.colorMoved = "default"; - credential.helper = "${pkgs.gitFull}/bin/git-credential-libsecret"; }; }; ssh = { diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index 30dc3cb7..7aa6e900 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: { imports = [ ./waybar/default.nix ]; services = { + gpg-agent.pinentryFlavor = "gnome3"; avizo.enable = true; syncthing.enable = true; udiskie = { diff --git a/system/default.nix b/system/default.nix index 64afcd42..875067fc 100644 --- a/system/default.nix +++ b/system/default.nix @@ -8,7 +8,8 @@ coreutils libsecret gnumake - gitFull + git + pinentry zip unzip fd