mirror of
https://codeberg.org/spire/nix.git
synced 2026-08-02 20:34:45 +02:00
fmt
This commit is contained in:
parent
3edf9df237
commit
f1707cebd8
9 changed files with 314 additions and 174 deletions
|
|
@ -1,30 +1,43 @@
|
|||
{ lib, stdenv, sourcemod-includes, sourcepawn, which }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
sourcemod-includes,
|
||||
sourcepawn,
|
||||
which,
|
||||
}: {
|
||||
defaultIncludes ? true,
|
||||
includes ? [],
|
||||
src,
|
||||
outPath ? "",
|
||||
...
|
||||
}@args: let
|
||||
} @ args: let
|
||||
inherit (lib) optionals;
|
||||
inherit (builtins) removeAttrs;
|
||||
allIncludes = includes ++ optionals defaultIncludes [sourcemod-includes];
|
||||
forwardAttrs = removeAttrs args ["defaultIncludes" "includes" "entrypoint"];
|
||||
spEnv = sourcepawn.buildEnv allIncludes;
|
||||
outPathRelative = if outPath == "" then "" else "/${outPath}";
|
||||
mkdirOut = if outPath == "" then "" else "mkdir -p $out";
|
||||
in stdenv.mkDerivation (rec {
|
||||
nativeBuildInputs = [spEnv which];
|
||||
dontUnpack = true;
|
||||
buildPhase = ''
|
||||
# absolute path is needed for spcomp to find the includes
|
||||
${spEnv}/bin/spcomp ${src} -o out.smx
|
||||
'';
|
||||
installPhase = ''
|
||||
${mkdirOut}
|
||||
cp out.smx $out${outPathRelative}
|
||||
'';
|
||||
testPhase = ''
|
||||
verifier out.smx
|
||||
'';
|
||||
} // args)
|
||||
outPathRelative =
|
||||
if outPath == ""
|
||||
then ""
|
||||
else "/${outPath}";
|
||||
mkdirOut =
|
||||
if outPath == ""
|
||||
then ""
|
||||
else "mkdir -p $out";
|
||||
in
|
||||
stdenv.mkDerivation (rec {
|
||||
nativeBuildInputs = [spEnv which];
|
||||
dontUnpack = true;
|
||||
buildPhase = ''
|
||||
# absolute path is needed for spcomp to find the includes
|
||||
spcomp ${src} -o out.smx
|
||||
'';
|
||||
installPhase = ''
|
||||
${mkdirOut}
|
||||
cp out.smx $out${outPathRelative}
|
||||
'';
|
||||
testPhase = ''
|
||||
verifier out.smx
|
||||
'';
|
||||
}
|
||||
// args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue