mirror of
https://codeberg.org/spire/nix.git
synced 2026-08-02 20:34:45 +02:00
init
This commit is contained in:
commit
e948e00e9b
14 changed files with 447 additions and 0 deletions
30
pkgs/build-sourcepawn-script.nix
Normal file
30
pkgs/build-sourcepawn-script.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ lib, stdenv, sourcemod-includes, sourcepawn, which }:
|
||||
{
|
||||
defaultIncludes ? true,
|
||||
includes ? [],
|
||||
src,
|
||||
outPath ? "",
|
||||
...
|
||||
}@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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue