Skip to content

Commit

Permalink
gpg: can configure scdaemon.conf (#1960)
Browse files Browse the repository at this point in the history
  • Loading branch information
colemickens authored Apr 28, 2021
1 parent 18ad12d commit c0ba8c5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions modules/programs/gpg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ let
listsAsDuplicateKeys = true;
} cfg.settings;

scdaemonCfgText = generators.toKeyValue {
inherit mkKeyValue;
listsAsDuplicateKeys = true;
} cfg.scdaemonSettings;

primitiveType = types.oneOf [ types.str types.bool ];
in
{
Expand Down Expand Up @@ -44,6 +49,20 @@ in
'';
};

scdaemonSettings = mkOption {
type = types.attrsOf (types.either primitiveType (types.listOf types.str));
example = literalExample ''
{
disable-ccid = true;
}
'';
description = ''
SCdaemon configuration options. Available options are described
in the gpg scdaemon manpage:
<link xlink:href="https://www.gnupg.org/documentation/manuals/gnupg/Scdaemon-Options.html"/>.
'';
};

homedir = mkOption {
type = types.path;
example = literalExample "\"\${config.xdg.dataHome}/gnupg\"";
Expand Down Expand Up @@ -75,11 +94,17 @@ in
use-agent = mkDefault true;
};

programs.gpg.scdaemonSettings = {
# no defaults for scdaemon
};

home.packages = [ cfg.package ];
home.sessionVariables = {
GNUPGHOME = cfg.homedir;
};

home.file."${cfg.homedir}/gpg.conf".text = cfgText;

home.file."${cfg.homedir}/scdaemon.conf".text = scdaemonCfgText;
};
}

0 comments on commit c0ba8c5

Please sign in to comment.