about summary refs log tree commit diff
path: root/nixos/modules/system/etc
diff options
context:
space:
mode:
authorMatthias Treydte <mt@waldheinz.de>2021-09-02 15:43:57 +0200
committerMatthias Treydte <mt@waldheinz.de>2021-09-02 15:50:44 +0200
commit9ce8df127d6d0b21ec3fc3864625677bb2fa73f6 (patch)
tree4fb624e98833b355e60c5032bf374d87879cc398 /nixos/modules/system/etc
parent1a34874288afb8811593559e9c8433ce29f15a2f (diff)
nixos/etc: make sure local "source" files are imported to the store
The treatment of the "source" parameter changed
with eb7120dc79966d5ed168321fd213de38de13a2b1, breaking stuff.

Before that commit, the source parameter was converted to a
string by implicit coercion, which would copy the file to the
store and yield an string containing the store path. Now, by
the virtue of escapeShellArg, toString is called explicitly on
that path, which will yield an string containing the absolute
path of the file.

This commit restores the old behavior.
Diffstat (limited to 'nixos/modules/system/etc')
-rw-r--r--nixos/modules/system/etc/etc.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index 6971ab42d99f2..84468ea31f741 100644
--- a/nixos/modules/system/etc/etc.nix
+++ b/nixos/modules/system/etc/etc.nix
@@ -6,7 +6,9 @@ with lib;
 
 let
 
-  etc' = filter (f: f.enable) (attrValues config.environment.etc);
+  # if the source is a local file, it should be imported to the store
+  localToStore = mapAttrs (name: value: if name == "source" then "${value}" else value);
+  etc' = map localToStore (filter (f: f.enable) (attrValues config.environment.etc));
 
   etc = pkgs.runCommandLocal "etc" {
     # This is needed for the systemd module