From ac7c05a90c6a2ed811d2245ae632ed3372eeefe7 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 18 Oct 2025 10:43:20 -0500 Subject: [PATCH] git: extraConfig -> settings Remove string support and convert to rfc42 settings option Signed-off-by: Austin Horstman --- modules/programs/bun.nix | 2 +- modules/programs/gh.nix | 2 +- modules/programs/git-credential-keepassxc.nix | 2 +- modules/programs/git-credential-oauth.nix | 2 +- modules/programs/git.nix | 24 +++++------------- modules/programs/mergiraf.nix | 2 +- tests/modules/programs/git/default.nix | 1 - .../git-with-str-extra-config-expected.conf | 11 -------- .../git/git-with-str-extra-config.nix | 25 ------------------- tests/modules/programs/git/git.nix | 11 ++++---- 10 files changed, 17 insertions(+), 65 deletions(-) delete mode 100644 tests/modules/programs/git/git-with-str-extra-config-expected.conf delete mode 100644 tests/modules/programs/git/git-with-str-extra-config.nix diff --git a/modules/programs/bun.nix b/modules/programs/bun.nix index 83daaa85c..e9d45baa3 100644 --- a/modules/programs/bun.nix +++ b/modules/programs/bun.nix @@ -64,7 +64,7 @@ in programs.git.attributes = lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) [ "*.lockb binary diff=lockb" ]; - programs.git.extraConfig.diff.lockb = lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) { + programs.git.settings.diff.lockb = lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) { textconv = lib.getExe cfg.package; binary = true; }; diff --git a/modules/programs/gh.nix b/modules/programs/gh.nix index 86a8cb0db..5c70f1861 100644 --- a/modules/programs/gh.nix +++ b/modules/programs/gh.nix @@ -188,7 +188,7 @@ in fi ''; - programs.git.extraConfig.credential = mkIf cfg.gitCredentialHelper.enable ( + programs.git.settings.credential = mkIf cfg.gitCredentialHelper.enable ( builtins.listToAttrs ( map ( host: diff --git a/modules/programs/git-credential-keepassxc.nix b/modules/programs/git-credential-keepassxc.nix index c6c8ec016..ac2038864 100644 --- a/modules/programs/git-credential-keepassxc.nix +++ b/modules/programs/git-credential-keepassxc.nix @@ -35,7 +35,7 @@ in config = lib.mkIf cfg.enable { home.packages = [ cfg.package ]; - programs.git.extraConfig.credential = + programs.git.settings.credential = let helperConfig = let diff --git a/modules/programs/git-credential-oauth.nix b/modules/programs/git-credential-oauth.nix index 799b463a8..fcb1fe6a6 100644 --- a/modules/programs/git-credential-oauth.nix +++ b/modules/programs/git-credential-oauth.nix @@ -35,7 +35,7 @@ in config = lib.mkIf cfg.enable { home.packages = [ cfg.package ]; - programs.git.extraConfig.credential.helper = lib.mkAfter [ + programs.git.settings.credential.helper = lib.mkAfter [ ( "${cfg.package}/bin/git-credential-oauth" + lib.optionalString (cfg.extraFlags != [ ]) " ${lib.strings.concatStringsSep " " cfg.extraFlags}" diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 5a0678c9e..e9c9c7bfd 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -111,8 +111,8 @@ in }; }; - extraConfig = mkOption { - type = types.either types.lines gitIniType; + settings = mkOption { + type = gitIniType; default = { }; example = { core = { @@ -121,8 +121,8 @@ in url."ssh://git@host".insteadOf = "otherhost"; }; description = '' - Additional configuration to add. The use of string values is - deprecated and will be removed in the future. + Configuration written to {file}`$XDG_CONFIG_HOME/git/config`. + See {manpage}`git-config(1)` for details. ''; }; @@ -440,20 +440,8 @@ in (mkIf (cfg.aliases != { }) { programs.git.iniContent.alias = cfg.aliases; }) - (mkIf (lib.isAttrs cfg.extraConfig) { - programs.git.iniContent = cfg.extraConfig; - }) - - (mkIf (lib.isString cfg.extraConfig) { - warnings = [ - '' - Using programs.git.extraConfig as a string option is - deprecated and will be removed in the future. Please - change to using it as an attribute set instead. - '' - ]; - - xdg.configFile."git/config".text = cfg.extraConfig; + (mkIf (cfg.settings != { }) { + programs.git.iniContent = cfg.settings; }) (mkIf (cfg.includes != [ ]) { diff --git a/modules/programs/mergiraf.nix b/modules/programs/mergiraf.nix index 3dfb798fc..b79bacb9a 100644 --- a/modules/programs/mergiraf.nix +++ b/modules/programs/mergiraf.nix @@ -29,7 +29,7 @@ in programs.git = { attributes = [ "* merge=mergiraf" ]; - extraConfig = { + settings = { merge = { mergiraf = { name = "mergiraf"; diff --git a/tests/modules/programs/git/default.nix b/tests/modules/programs/git/default.nix index 15380ffc2..8b86cef6e 100644 --- a/tests/modules/programs/git/default.nix +++ b/tests/modules/programs/git/default.nix @@ -2,7 +2,6 @@ git-with-email = ./git-with-email.nix; git-with-most-options = ./git.nix; git-with-msmtp = ./git-with-msmtp.nix; - git-with-str-extra-config = ./git-with-str-extra-config.nix; git-with-signing-key-id-legacy = ./git-with-signing-key-id-legacy.nix; git-with-signing-key-id = ./git-with-signing-key-id.nix; git-without-signing-key-id = ./git-without-signing-key-id.nix; diff --git a/tests/modules/programs/git/git-with-str-extra-config-expected.conf b/tests/modules/programs/git/git-with-str-extra-config-expected.conf deleted file mode 100644 index 8c9b7ee11..000000000 --- a/tests/modules/programs/git/git-with-str-extra-config-expected.conf +++ /dev/null @@ -1,11 +0,0 @@ -This can be anything. - -[gpg] - format = "openpgp" - -[gpg "openpgp"] - program = "path-to-gpg" - -[user] - email = "user@example.org" - name = "John Doe" diff --git a/tests/modules/programs/git/git-with-str-extra-config.nix b/tests/modules/programs/git/git-with-str-extra-config.nix deleted file mode 100644 index 94264af73..000000000 --- a/tests/modules/programs/git/git-with-str-extra-config.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - programs.git = { - enable = true; - signing.signer = "path-to-gpg"; - extraConfig = '' - This can be anything. - ''; - userEmail = "user@example.org"; - userName = "John Doe"; - }; - - test.asserts.warnings.expected = [ - '' - Using programs.git.extraConfig as a string option is - deprecated and will be removed in the future. Please - change to using it as an attribute set instead. - '' - ]; - - nmt.script = '' - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config \ - ${./git-with-str-extra-config-expected.conf} - ''; -} diff --git a/tests/modules/programs/git/git.nix b/tests/modules/programs/git/git.nix index de579c462..1be7c166d 100644 --- a/tests/modules/programs/git/git.nix +++ b/tests/modules/programs/git/git.nix @@ -73,11 +73,12 @@ in { aliases.a2 = lib.mkForce "baz"; - extraConfig."extra \"backcompat.with.dots\"".previously = "worked"; - extraConfig.extra.boolean = true; - extraConfig.extra.integer = 38; - extraConfig.extra.multiple = [ 2 ]; - extraConfig.extra.subsection.value = "test"; + settings.alias.a2 = lib.mkForce "baz"; + settings."extra \"backcompat.with.dots\"".previously = "worked"; + settings.extra.boolean = true; + settings.extra.integer = 38; + settings.extra.multiple = [ 2 ]; + settings.extra.subsection.value = "test"; } ];