mirror of
https://codeberg.org/spire/nix.git
synced 2026-08-02 20:34:45 +02:00
flake reorg
This commit is contained in:
parent
40d16cd6e9
commit
67537a38e0
15 changed files with 70 additions and 96 deletions
40
nix/build-sourcepawn-script.nix
Normal file
40
nix/build-sourcepawn-script.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
sourcepawn,
|
||||
which,
|
||||
}: {
|
||||
defaultIncludes ? true,
|
||||
includes ? [],
|
||||
src,
|
||||
outPath ? "",
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) optionals;
|
||||
allIncludes = includes ++ optionals defaultIncludes [sourcepawn.includes.sourcemod];
|
||||
spEnv = sourcepawn.buildEnv allIncludes;
|
||||
outPathRelative =
|
||||
if outPath == ""
|
||||
then ""
|
||||
else "/${outPath}";
|
||||
mkdirOut =
|
||||
if outPath == ""
|
||||
then ""
|
||||
else "mkdir -p $out";
|
||||
in
|
||||
stdenv.mkDerivation ({
|
||||
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