aboutsummaryrefslogtreecommitdiffstats
path: root/modules/security/gopass/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/security/gopass/default.nix')
-rw-r--r--modules/security/gopass/default.nix50
1 files changed, 13 insertions, 37 deletions
diff --git a/modules/security/gopass/default.nix b/modules/security/gopass/default.nix
index 4cf9182..123b33f 100644
--- a/modules/security/gopass/default.nix
+++ b/modules/security/gopass/default.nix
@@ -5,30 +5,6 @@
pkgs,
...
}:
-let
- gopassKeys = config.security.ssh.gopassKeys;
-
- gopassSshLoadScript = pkgs.writeShellApplication {
- name = "gopass-ssh-load";
- runtimeInputs = [
- config.security.gopass.package
- config.security.gpg.package
- config.security.ssh.package
- config.terminal.bash.package
- ];
- text =
- builtins.replaceStrings
- [
- "@@GOPASS_SSH_KEYS@@"
- "@@GNUPGHOME@@"
- ]
- [
- (lib.concatStringsSep " " gopassKeys)
- config.home.sessionVariables.GNUPGHOME
- ]
- (builtins.readFile ./gopass-ssh-load.sh);
- };
-in
{
options.security.gopass = {
enable = lib.mkEnableOption "Enables gopass.";
@@ -38,15 +14,6 @@ in
default = config.programs.password-store.package;
description = "The gopass package to use.";
};
- ssh-agent = {
- enable = lib.mkEnableOption "gopass-backed SSH keys for git";
- package = lib.mkOption {
- type = lib.types.package;
- readOnly = true;
- default = gopassSshLoadScript;
- description = "The gopass-ssh-load script package.";
- };
- };
sync = {
enable = lib.mkEnableOption "Enables git-backed syncing of the gopass data directory.";
remote = lib.mkOption {
@@ -67,6 +34,9 @@ in
};
};
};
+ creation-templates = {
+ enable = lib.mkEnableOption "Enables gopass entry creation templates. New entry creation templates for gopass new or gopass create commands.";
+ };
};
config = lib.mkMerge [
@@ -116,6 +86,16 @@ in
source = ../../../assets/icons/apps/gopass.svg;
};
+ home.activation.copyCreationTemplatesForGopass =
+ lib.mkIf config.security.gopass.creation-templates.enable
+ (
+ lib.hm.dag.entryAfter [ "writeBoundary" ] ''
+ $DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${config.programs.password-store.settings.PASSWORD_STORE_DIR}/.gopass/create"
+ $DRY_RUN_CMD rm -rf ${config.programs.password-store.settings.PASSWORD_STORE_DIR}/.gopass/create
+ $DRY_RUN_CMD cp -r $VERBOSE_ARG --no-preserve=mode ${./creation-templates} "${config.programs.password-store.settings.PASSWORD_STORE_DIR}/.gopass/create"
+ ''
+ );
+
xdg.desktopEntries."gopass" = {
name = "gopass";
exec = "${lib.getExe config.terminal.kitty.package} --class gopass -e ${lib.getExe config.security.gopass.package}";
@@ -127,10 +107,6 @@ in
};
})
- (lib.mkIf config.security.gopass.ssh-agent.enable {
- home.packages = [ config.security.gopass.ssh-agent.package ];
- })
-
(lib.mkIf config.security.gopass.sync.enable {
home.activation.gopassSyncInit =
let