replace getDirectory with builtins.dirOf
This commit is contained in:
parent
b3c4693262
commit
b837ac9be5
1 changed files with 4 additions and 9 deletions
13
engine.nix
13
engine.nix
|
@ -1,20 +1,15 @@
|
||||||
pkgs: {extraArgs, entries, templates}: let
|
pkgs: {extraArgs, entries, templates}: let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
inherit (builtins) abort;
|
inherit (builtins) abort dirOf;
|
||||||
inherit (lib.lists) elemAt forEach findFirst length remove;
|
inherit (lib.lists) forEach findFirst;
|
||||||
inherit (lib.strings) concatMapStrings concatStrings escapeShellArg isString splitString;
|
inherit (lib.strings) concatMapStrings concatStrings escapeShellArg isString;
|
||||||
inherit (lib.trivial) functionArgs;
|
inherit (lib.trivial) functionArgs;
|
||||||
|
|
||||||
args = {inherit pkgs;}
|
args = {inherit pkgs;}
|
||||||
// (import ./stdlib.nix pkgs)
|
// (import ./stdlib.nix pkgs)
|
||||||
// extraArgs;
|
// extraArgs;
|
||||||
|
|
||||||
getDirectory = file: let
|
|
||||||
splitPath = splitString "/" file;
|
|
||||||
last = elemAt splitPath ((length splitPath) - 1);
|
|
||||||
in
|
|
||||||
concatStrings (remove last splitPath);
|
|
||||||
|
|
||||||
findTemplateFile = entry:
|
findTemplateFile = entry:
|
||||||
findFirst (templateFile: let
|
findFirst (templateFile: let
|
||||||
|
@ -56,7 +51,7 @@ pkgs: {extraArgs, entries, templates}: let
|
||||||
in /*sh*/''
|
in /*sh*/''
|
||||||
${concatMapStrings
|
${concatMapStrings
|
||||||
(result: /*sh*/''
|
(result: /*sh*/''
|
||||||
mkdir -p $out/${getDirectory result.file}
|
mkdir -p $out/${dirOf result.file}
|
||||||
echo ${escapeShellArg result.output} > $out/${result.file}
|
echo ${escapeShellArg result.output} > $out/${result.file}
|
||||||
'')
|
'')
|
||||||
(forEach entries processEntryFile)
|
(forEach entries processEntryFile)
|
||||||
|
|
Loading…
Reference in a new issue