1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-19 00:09:48 +01:00
home-manager/modules/programs/password-store.nix

66 lines
1.7 KiB
Nix
Raw Normal View History

2019-07-14 21:09:53 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.password-store;
2020-02-02 00:39:17 +01:00
in {
2019-07-14 21:09:53 +02:00
meta.maintainers = with maintainers; [ pacien ];
options.programs.password-store = {
enable = mkEnableOption "Password store";
2019-07-14 21:09:53 +02:00
package = mkOption {
type = types.package;
default = pkgs.pass;
defaultText = literalExpression "pkgs.pass";
example = literalExpression ''
2019-07-14 21:09:53 +02:00
pkgs.pass.withExtensions (exts: [ exts.pass-otp ])
'';
description = ''
The `pass` package to use.
2019-07-14 21:09:53 +02: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";
};
defaultText = literalExpression ''
2019-07-14 21:09:53 +02:00
{ PASSWORD_STORE_DIR = "$XDG_DATA_HOME/password-store"; }
'';
example = literalExpression ''
2019-07-14 21:09:53 +02:00
{
PASSWORD_STORE_DIR = "/some/directory";
PASSWORD_STORE_KEY = "12345678";
PASSWORD_STORE_CLIP_TIME = "60";
}
'';
description = ''
The `pass` environment variables dictionary.
2019-07-14 21:09:53 +02:00
See the "Environment variables" section of
{manpage}`pass(1)`
2019-07-14 21:09:53 +02: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;
services.pass-secret-service.storePath =
mkDefault cfg.settings.PASSWORD_STORE_DIR;
xsession.importedVariables = mkIf config.xsession.enable
(mapAttrsToList (name: value: name) cfg.settings);
2019-07-14 21:09:53 +02:00
};
}