mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
gpg: allow for duplicate keys in config (#1814)
Allow for duplicate keys in the form of a list of strings. Also update the `settings` example configuration to use `literalExample`.
This commit is contained in:
parent
2b7a73071a
commit
eb3a0342a8
3 changed files with 26 additions and 15 deletions
|
@ -5,25 +5,30 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.programs.gpg;
|
cfg = config.programs.gpg;
|
||||||
|
|
||||||
cfgText =
|
mkKeyValue = key: value:
|
||||||
concatStringsSep "\n"
|
if isString value
|
||||||
(attrValues
|
then "${key} ${value}"
|
||||||
(mapAttrs (key: value:
|
else optionalString value key;
|
||||||
if isString value
|
|
||||||
then "${key} ${value}"
|
|
||||||
else optionalString value key)
|
|
||||||
cfg.settings));
|
|
||||||
|
|
||||||
in {
|
cfgText = generators.toKeyValue {
|
||||||
|
inherit mkKeyValue;
|
||||||
|
listsAsDuplicateKeys = true;
|
||||||
|
} cfg.settings;
|
||||||
|
|
||||||
|
primitiveType = types.oneOf [ types.str types.bool ];
|
||||||
|
in
|
||||||
|
{
|
||||||
options.programs.gpg = {
|
options.programs.gpg = {
|
||||||
enable = mkEnableOption "GnuPG";
|
enable = mkEnableOption "GnuPG";
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = types.attrsOf (types.either types.str types.bool);
|
type = types.attrsOf (types.either primitiveType (types.listOf types.str));
|
||||||
example = {
|
example = literalExample ''
|
||||||
no-comments = false;
|
{
|
||||||
s2k-cipher-algo = "AES128";
|
no-comments = false;
|
||||||
};
|
s2k-cipher-algo = "AES128";
|
||||||
|
}
|
||||||
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
GnuPG configuration options. Available options are described
|
GnuPG configuration options. Available options are described
|
||||||
in the gpg manpage:
|
in the gpg manpage:
|
||||||
|
|
|
@ -14,6 +14,8 @@ require-cross-certification
|
||||||
s2k-cipher-algo AES128
|
s2k-cipher-algo AES128
|
||||||
s2k-digest-algo SHA512
|
s2k-digest-algo SHA512
|
||||||
throw-keyids
|
throw-keyids
|
||||||
|
trusted-key 0xXXXXXXXXXXXXX
|
||||||
|
trusted-key 0xYYYYYYYYYYYYY
|
||||||
use-agent
|
use-agent
|
||||||
verify-options show-uid-validity
|
verify-options show-uid-validity
|
||||||
with-fingerprint
|
with-fingerprint
|
||||||
|
|
|
@ -11,6 +11,10 @@ with lib;
|
||||||
no-comments = false;
|
no-comments = false;
|
||||||
s2k-cipher-algo = "AES128";
|
s2k-cipher-algo = "AES128";
|
||||||
throw-keyids = true;
|
throw-keyids = true;
|
||||||
|
trusted-key = [
|
||||||
|
"0xXXXXXXXXXXXXX"
|
||||||
|
"0xYYYYYYYYYYYYY"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue