2019-07-14 19:09:53 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.password-store;
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
in {
|
2019-07-14 19:09:53 +00:00
|
|
|
meta.maintainers = with maintainers; [ pacien ];
|
|
|
|
|
|
|
|
options.programs.password-store = {
|
2023-07-01 23:45:18 +00:00
|
|
|
enable = mkEnableOption "Password store";
|
2019-07-14 19:09:53 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.pass;
|
2021-10-09 09:14:08 +00:00
|
|
|
defaultText = literalExpression "pkgs.pass";
|
|
|
|
example = literalExpression ''
|
2019-07-14 19:09:53 +00:00
|
|
|
pkgs.pass.withExtensions (exts: [ exts.pass-otp ])
|
|
|
|
'';
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2023-06-30 23:30:13 +00:00
|
|
|
The `pass` package to use.
|
2019-07-14 19:09:53 +00:00
|
|
|
Can be used to specify extensions.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption rec {
|
|
|
|
type = with types; attrsOf str;
|
|
|
|
apply = mergeAttrs default;
|
|
|
|
default = {
|
|
|
|
PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store";
|
|
|
|
};
|
2021-10-09 09:14:08 +00:00
|
|
|
defaultText = literalExpression ''
|
2019-07-14 19:09:53 +00:00
|
|
|
{ PASSWORD_STORE_DIR = "$XDG_DATA_HOME/password-store"; }
|
|
|
|
'';
|
2021-10-09 09:14:08 +00:00
|
|
|
example = literalExpression ''
|
2019-07-14 19:09:53 +00:00
|
|
|
{
|
|
|
|
PASSWORD_STORE_DIR = "/some/directory";
|
|
|
|
PASSWORD_STORE_KEY = "12345678";
|
|
|
|
PASSWORD_STORE_CLIP_TIME = "60";
|
|
|
|
}
|
|
|
|
'';
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2023-06-30 23:30:13 +00:00
|
|
|
The `pass` environment variables dictionary.
|
|
|
|
|
2019-07-14 19:09:53 +00:00
|
|
|
See the "Environment variables" section of
|
2023-06-30 23:30:13 +00:00
|
|
|
{manpage}`pass(1)`
|
2019-07-14 19:09:53 +00:00
|
|
|
and the extension man pages for more information about the
|
|
|
|
available keys.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
home.sessionVariables = cfg.settings;
|
2021-06-13 22:27:31 +00:00
|
|
|
|
2022-05-07 18:05:10 +00:00
|
|
|
services.pass-secret-service.storePath =
|
|
|
|
mkDefault cfg.settings.PASSWORD_STORE_DIR;
|
|
|
|
|
2021-06-13 22:27:31 +00:00
|
|
|
xsession.importedVariables = mkIf config.xsession.enable
|
|
|
|
(mapAttrsToList (name: value: name) cfg.settings);
|
2019-07-14 19:09:53 +00:00
|
|
|
};
|
|
|
|
}
|