nixos/etc: make sure local "source" files are imported to the store

The treatment of the "source" parameter changed
with eb7120dc79, 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.
launchpad/nixpkgs/master
Matthias Treydte 3 years ago
parent 1a34874288
commit 9ce8df127d
  1. 4
      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

Loading…
Cancel
Save