1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/programs/password-store.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

61 lines
1.6 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib) literalExpression mkOption types;
cfg = config.programs.password-store;
in
{
meta.maintainers = with lib.maintainers; [ euxane ];
options.programs.password-store = {
enable = lib.mkEnableOption "Password store";
package = lib.mkPackageOption pkgs "pass" {
example = "pkgs.pass.withExtensions (exts: [ exts.pass-otp ])";
extraDescription = "Can be used to specify extensions.";
};
settings = mkOption rec {
type = with types; attrsOf str;
apply = lib.mergeAttrs default;
default = {
PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store";
};
defaultText = literalExpression ''
{ PASSWORD_STORE_DIR = "$XDG_DATA_HOME/password-store"; }
'';
example = literalExpression ''
{
PASSWORD_STORE_DIR = "/some/directory";
PASSWORD_STORE_KEY = "12345678";
PASSWORD_STORE_CLIP_TIME = "60";
}
'';
description = ''
The `pass` environment variables dictionary.
See the "Environment variables" section of
{manpage}`pass(1)`
and the extension man pages for more information about the
available keys.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
home.sessionVariables = cfg.settings;
services.pass-secret-service.storePath = lib.mkDefault cfg.settings.PASSWORD_STORE_DIR;
xsession.importedVariables = lib.mkIf config.xsession.enable (
lib.mapAttrsToList (name: value: name) cfg.settings
);
};
}