feat: clone password-store if it not exists yet

This commit is contained in:
Ryan Yin
2024-01-26 22:37:05 +08:00
parent 7f72a0612b
commit b75195d339
+13 -2
View File
@@ -3,7 +3,9 @@
config, config,
lib, lib,
... ...
}: { }: let
passwordStoreDir = "${config.xdg.dataHome}/password-store";
in {
programs.password-store = { programs.password-store = {
enable = true; enable = true;
package = pkgs.pass.withExtensions (exts: [ package = pkgs.pass.withExtensions (exts: [
@@ -16,7 +18,7 @@
]); ]);
# See the “Environment variables” section of pass(1) and the extension man pages for more information about the available keys. # See the “Environment variables” section of pass(1) and the extension man pages for more information about the available keys.
settings = { settings = {
PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store"; PASSWORD_STORE_DIR = passwordStoreDir;
# Overrides the default gpg key identification set by init. # Overrides the default gpg key identification set by init.
# Hexadecimal key signature is recommended. # Hexadecimal key signature is recommended.
# Multiple keys may be specified separated by spaces. # Multiple keys may be specified separated by spaces.
@@ -47,4 +49,13 @@
"firefox" "firefox"
]; ];
}; };
# clone password-store repo if not exists
home.activation.initPasswordStore = lib.hm.dag.entryAfter ["writeBoundary"] ''
${pkgs.nushell}/bin/nu -c '
if not ("${passwordStoreDir}" | path exists) {
${pkgs.git}/bin/git clone --depth 1 git@github.com:ryan4yin/password-store.git
}
'
'';
} }