1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 13:39:46 +01:00

gpg: add dirmngrSettings

This commit is contained in:
北雁 Cryolitia 2024-05-09 05:27:22 +08:00
parent f37049e85f
commit 2905e7bd16
No known key found for this signature in database
GPG key ID: 3E5D1772FC8A8EDD

View file

@ -18,6 +18,11 @@ let
listsAsDuplicateKeys = true; listsAsDuplicateKeys = true;
} cfg.scdaemonSettings; } cfg.scdaemonSettings;
dirmngrCfgText = generators.toKeyValue {
inherit mkKeyValue;
listsAsDuplicateKeys = true;
} cfg.dirmngrSettings;
primitiveType = types.oneOf [ types.str types.bool ]; primitiveType = types.oneOf [ types.str types.bool ];
publicKeyOpts = { config, ... }: { publicKeyOpts = { config, ... }: {
@ -187,6 +192,24 @@ in {
''; '';
}; };
dirmngrSettings = mkOption {
type =
types.attrsOf (types.either primitiveType (types.listOf types.str));
example = literalExpression ''
{
keyserver = "keyserver.ubuntu.com";
disable-ipv6 = true;
}
'';
description = ''
Dirmngr configuration options. Available options are described
in
[
{manpage}`dirmngr(8)`
](https://www.gnupg.org/documentation/manuals/gnupg/Dirmngr-Options.html).
'';
};
homedir = mkOption { homedir = mkOption {
type = types.path; type = types.path;
example = literalExpression ''"''${config.xdg.dataHome}/gnupg"''; example = literalExpression ''"''${config.xdg.dataHome}/gnupg"'';
@ -247,6 +270,9 @@ in {
programs.gpg.scdaemonSettings = { programs.gpg.scdaemonSettings = {
# no defaults for scdaemon # no defaults for scdaemon
}; };
programs.gpg.dirmngrSettings = {
# no defaults for dirmngr
};
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
home.sessionVariables = { GNUPGHOME = cfg.homedir; }; home.sessionVariables = { GNUPGHOME = cfg.homedir; };
@ -255,6 +281,8 @@ in {
home.file."${cfg.homedir}/scdaemon.conf".text = scdaemonCfgText; home.file."${cfg.homedir}/scdaemon.conf".text = scdaemonCfgText;
home.file."${cfg.homedir}/dirmngr.conf".text = dirmngrCfgText;
# Link keyring if keys are not mutable # Link keyring if keys are not mutable
home.file."${cfg.homedir}/pubring.kbx" = home.file."${cfg.homedir}/pubring.kbx" =
mkIf (!cfg.mutableKeys && cfg.publicKeys != [ ]) { mkIf (!cfg.mutableKeys && cfg.publicKeys != [ ]) {