From 0e590c91d20efb1be7978347a2d45940a1d2fc2e Mon Sep 17 00:00:00 2001 From: Taeer Bar-Yam Date: Wed, 10 Nov 2021 22:01:31 -0500 Subject: [PATCH] etc module: make `.text` and `.source` the same priority Before this change, one could set environment.etc.*.text and .source. .source would always take precedence, regardless of the priorities set. This change means that if, for instance, .text is set with mkForce but .source is set normally, the .text content will be the one to take effect. If they are set with the same priority they will conflict. --- nixos/modules/system/etc/etc.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index 8f14f04a1f64..225a5683e79e 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -85,7 +85,7 @@ in ''; type = with types; attrsOf (submodule ( - { name, config, ... }: + { name, config, options, ... }: { options = { enable = mkOption { @@ -172,7 +172,9 @@ in target = mkDefault name; source = mkIf (config.text != null) ( let name' = "etc-" + baseNameOf name; - in mkDefault (pkgs.writeText name' config.text)); + in mkOverride + (options.text.highestPrio or lib.modules.defaultPriority) + (pkgs.writeText name' config.text)); }; }));