add extraFiles to mkNteDerivation
not so simple anymore is it
This commit is contained in:
parent
cd9e2ff93e
commit
cd3efc420c
1 changed files with 25 additions and 1 deletions
26
nte-drv.nix
26
nte-drv.nix
|
@ -5,7 +5,12 @@ pkgs: engine: {
|
|||
extraArgs ? {},
|
||||
entries ? [],
|
||||
templates ? [],
|
||||
}: pkgs.stdenv.mkDerivation {
|
||||
extraFiles ? []
|
||||
}: let
|
||||
inherit (pkgs) lib;
|
||||
inherit (lib.lists) forEach init;
|
||||
inherit (lib.strings) concatStrings match normalizePath optionalString splitString;
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
inherit name version src;
|
||||
|
||||
buildPhase = /*sh*/''
|
||||
|
@ -15,4 +20,23 @@ pkgs: engine: {
|
|||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = optionalString (extraFiles != []) /*sh*/''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
|
||||
${concatStrings (forEach extraFiles
|
||||
(extraFile: let
|
||||
isInSubdir = (match ".+/.+" extraFile.destination) != null;
|
||||
outDir = concatStrings (init (splitString "/" extraFile.destination));
|
||||
outPath = normalizePath "$out/${extraFile.destination}";
|
||||
in /*sh*/''
|
||||
${optionalString isInSubdir /*sh*/"mkdir -p ${outDir}"}
|
||||
cp -r ${extraFile.source} ${outPath}
|
||||
''))
|
||||
}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue