nixos/etc: simplify source path handling
This change is strictly functionally equivalent because we're just lifting the transformation of `source` out of `mapAttrs` to the single point of use (in escapeShellArgs). This is also much faster because we can skip a map over all `etc` items.
This commit is contained in:
parent
f05a99e116
commit
654f41435b
1 changed files with 3 additions and 4 deletions
|
@ -6,9 +6,7 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# if the source is a local file, it should be imported to the store
|
etc' = filter (f: f.enable) (attrValues config.environment.etc);
|
||||||
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" {
|
etc = pkgs.runCommandLocal "etc" {
|
||||||
# This is needed for the systemd module
|
# This is needed for the systemd module
|
||||||
|
@ -55,7 +53,8 @@ let
|
||||||
mkdir -p "$out/etc"
|
mkdir -p "$out/etc"
|
||||||
${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
|
${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
|
||||||
"makeEtcEntry"
|
"makeEtcEntry"
|
||||||
etcEntry.source
|
# Force local source paths to be added to the store
|
||||||
|
"${etcEntry.source}"
|
||||||
etcEntry.target
|
etcEntry.target
|
||||||
etcEntry.mode
|
etcEntry.mode
|
||||||
etcEntry.user
|
etcEntry.user
|
||||||
|
|
Loading…
Reference in a new issue