From 9ce8df127d6d0b21ec3fc3864625677bb2fa73f6 Mon Sep 17 00:00:00 2001 From: Matthias Treydte Date: Thu, 2 Sep 2021 15:43:57 +0200 Subject: [PATCH] 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. --- nixos/modules/system/etc/etc.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index 6971ab42d99..84468ea31f7 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