From 1b5fabc20ae2db0de476a3cc9a5b2476d08359df Mon Sep 17 00:00:00 2001 From: Ezri Zhu Date: Fri, 16 Aug 2024 17:52:35 -0400 Subject: [PATCH] git: add config option for gpg.format git provides three options for signing key format, openpgp(default), ssh, and x509. This commit provides the option to specify one of the other two available formats. --- modules/programs/git.nix | 12 ++++++++++++ tests/modules/programs/git/git-expected.conf | 1 + tests/modules/programs/git/git.nix | 1 + 3 files changed, 14 insertions(+) diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 3061feff7..d344baab6 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -38,6 +38,17 @@ let defaultText = "\${pkgs.gnupg}/bin/gpg2"; description = "Path to GnuPG binary to use."; }; + + gpgFormat = mkOption { + type = types.str; + default = "openpgp"; + defaultText = "openpgp"; + description = '' + Specifies which key format to use when signing with + --gpg-sign. Default is "openpgp". Other possible values + are "x509", "ssh". + ''; + }; }; }; @@ -421,6 +432,7 @@ in { commit.gpgSign = mkDefault cfg.signing.signByDefault; tag.gpgSign = mkDefault cfg.signing.signByDefault; gpg.program = cfg.signing.gpgPath; + gpg.format = cfg.signing.gpgFormat; }; }) diff --git a/tests/modules/programs/git/git-expected.conf b/tests/modules/programs/git/git-expected.conf index 61e0a2cc5..4dacc7ecd 100644 --- a/tests/modules/programs/git/git-expected.conf +++ b/tests/modules/programs/git/git-expected.conf @@ -38,6 +38,7 @@ smudge = "git-lfs smudge -- %f" [gpg] + format = "ssh" program = "path-to-gpg" [interactive] diff --git a/tests/modules/programs/git/git.nix b/tests/modules/programs/git/git.nix index fb949be00..cc6496480 100644 --- a/tests/modules/programs/git/git.nix +++ b/tests/modules/programs/git/git.nix @@ -55,6 +55,7 @@ in { } ]; signing = { + gpgFormat = "ssh"; gpgPath = "path-to-gpg"; key = "00112233445566778899AABBCCDDEEFF"; signByDefault = true;