From ad04237d5142f53dcba258942b78e2d2bbf210c8 Mon Sep 17 00:00:00 2001 From: lunik1 <13547699+lunik1@users.noreply.github.com> Date: Wed, 31 Mar 2021 20:01:02 +0000 Subject: [PATCH] dircolors: apply extraConfig after settings (#1890) Applying extraConfig before settings made it unable to override the defaults. --- modules/misc/news.nix | 7 +++++++ modules/programs/dircolors.nix | 4 ++-- tests/modules/programs/dircolors/settings-expected.conf | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 301136441..88fcf075b 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1880,6 +1880,13 @@ in https://no-color.org/. ''; } + { + time = "2021-03-29T21:05:50+00:00"; + message = '' + Configuration specified by 'programs.dircolors.extraConfig' is now + applied after 'programs.dircolors.settings'. + ''; + } ]; }; } diff --git a/modules/programs/dircolors.nix b/modules/programs/dircolors.nix index 026de72d7..6ac16da50 100644 --- a/modules/programs/dircolors.nix +++ b/modules/programs/dircolors.nix @@ -204,8 +204,8 @@ in { }; home.file.".dir_colors".text = concatStringsSep "\n" ([ ] - ++ optional (cfg.extraConfig != "") cfg.extraConfig - ++ mapAttrsToList formatLine cfg.settings) + "\n"; + ++ mapAttrsToList formatLine cfg.settings ++ [ "" ] + ++ optional (cfg.extraConfig != "") cfg.extraConfig); programs.bash.initExtra = mkIf cfg.enableBashIntegration '' eval $(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors) diff --git a/tests/modules/programs/dircolors/settings-expected.conf b/tests/modules/programs/dircolors/settings-expected.conf index 17bc247c0..d490081b3 100644 --- a/tests/modules/programs/dircolors/settings-expected.conf +++ b/tests/modules/programs/dircolors/settings-expected.conf @@ -1,5 +1,3 @@ -# Extra dircolors configuration. - .7z 01;31 .aac 00;36 .ace 01;31 @@ -131,3 +129,5 @@ SETUID 37;41 SOCK 01;35 STICKY 37;44 STICKY_OTHER_WRITABLE 30;42 + +# Extra dircolors configuration.