mirror of
https://codeberg.org/spire/nix.git
synced 2026-06-03 09:54:19 +02:00
init
This commit is contained in:
commit
e948e00e9b
14 changed files with 447 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
73
.github/workflows/ci.yml
vendored
Normal file
73
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sdk-matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- id: set-matrix
|
||||||
|
run: echo "matrix={\"sdk\":$(nix eval --json ".#sdks.x86_64-linux")}" | tee $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
hl2sdk:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: sdk-matrix
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{fromJson(needs.hl2sdk-matrix.outputs.matrix)}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build .#hl2sdk.${{ matrix.sdk }}
|
||||||
|
|
||||||
|
ambuild:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build .#ambuild
|
||||||
|
|
||||||
|
sourcemod:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [hl2sdk-matrix, ambuild, hl2sdk]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{fromJson(needs.hl2sdk-matrix.outputs.matrix)}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build .#sourcemods.${{ matrix.sdk }}
|
||||||
|
|
||||||
|
sourcepawn:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ambuild]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build .#sourcepawn
|
||||||
|
- name: Compile test script
|
||||||
|
run: nix build .#buildTestScript
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
result
|
||||||
|
.direnv
|
||||||
34
README.md
Normal file
34
README.md
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Spire nix packages
|
||||||
|
|
||||||
|
A set of tf2 related nix packages
|
||||||
|
|
||||||
|
## Packages
|
||||||
|
|
||||||
|
The following is currently packaged:
|
||||||
|
|
||||||
|
- `ambuild`
|
||||||
|
- `sourcepawn`
|
||||||
|
- `metamod-source`
|
||||||
|
- `sourcemod`
|
||||||
|
|
||||||
|
|
||||||
|
### Sourcemod SDKs
|
||||||
|
|
||||||
|
For the `sourcemod` package, you need to enable one or more SDKs at build time.
|
||||||
|
The SDKs are packaged under the `hl2sdk` package and can be enabled like in the following example.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
pkgs.sourcemod.override {sdks = {inherit (pkgs.hl2sdk) tf2;};};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building sourcepawn script
|
||||||
|
|
||||||
|
```nix
|
||||||
|
buildSourcePawnScript {
|
||||||
|
name = "test";
|
||||||
|
src = ./test.sp;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
By default the sourcemod includes are available.
|
||||||
|
Additional includes can be added by setting the `includes` argument to an array of packages containing an `include` folder containing the `.inc` files.
|
||||||
60
flake.lock
generated
Normal file
60
flake.lock
generated
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1688825351,
|
||||||
|
"narHash": "sha256-XKrQsDLF/XvKbuF7j6ihcIpLFk2zB6yMa/RmEi5s3bc=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "3dce5e9104d5a1658b8edc0900c916f6b0853648",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "release-23.05",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"utils": "utils"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1687709756,
|
||||||
|
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
37
flake.nix
Normal file
37
flake.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
utils.url = "github:numtide/flake-utils";
|
||||||
|
nixpkgs.url = "nixpkgs/release-23.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
utils,
|
||||||
|
}:
|
||||||
|
utils.lib.eachDefaultSystem (system: let
|
||||||
|
inherit (builtins) mapAttrs attrNames;
|
||||||
|
overlays = [(import ./pkgs)];
|
||||||
|
pkgs = (import nixpkgs) {
|
||||||
|
inherit system overlays;
|
||||||
|
};
|
||||||
|
testScript = pkgs.fetchurl {
|
||||||
|
url = "https://raw.githubusercontent.com/spiretf/nocheats/master/plugin/nocheats.sp";
|
||||||
|
sha256 = "sha256-Z3RJhuc9c8YQTo9gnLTBrqL4JpADZgDttrJVyE/MWdM=";
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
packages = rec {
|
||||||
|
inherit (pkgs) ambuild sourcemod sourcepawn sourcemod-includes buildSourcePawnScript hl2sdk;
|
||||||
|
sourcemods = mapAttrs (name: sdk: pkgs.sourcemod.override {sdks = {${name} = sdk;};}) hl2sdk;
|
||||||
|
buildTestScript = buildSourcePawnScript {name = "test"; src = testScript;};
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [];
|
||||||
|
};
|
||||||
|
|
||||||
|
sdks = attrNames packages.hl2sdk;
|
||||||
|
|
||||||
|
overlays.default = import ./pkgs;
|
||||||
|
});
|
||||||
|
}
|
||||||
21
pkgs/ambuild.nix
Normal file
21
pkgs/ambuild.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{ lib, buildPythonPackage, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildPythonPackage rec {
|
||||||
|
pname = "ambuild";
|
||||||
|
version = "2.2.3-dev";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "alliedmodders";
|
||||||
|
repo = pname;
|
||||||
|
rev = "9392da7c7e0a148bf8e0089b88d372a6eb62c65c";
|
||||||
|
sha256 = "sha256-4Ar6EWhgUiO5ZHna5JqwRHlYeh54WjZi0xqv/u3tqOU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://github.com/alliedmodders/ambuild";
|
||||||
|
description = "AMBuild is a lightweight build system designed for performance and accuracy";
|
||||||
|
license = licenses.bsd3;
|
||||||
|
};
|
||||||
|
}
|
||||||
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)
|
||||||
9
pkgs/default.nix
Normal file
9
pkgs/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
final: prev: {
|
||||||
|
hl2sdk = final.callPackage ./hl2sdk.nix {};
|
||||||
|
ambuild = final.python3Packages.callPackage ./ambuild.nix {};
|
||||||
|
metamod-source = final.callPackage ./metamod-source.nix {};
|
||||||
|
sourcemod = final.callPackage ./sourcemod.nix {};
|
||||||
|
sourcepawn = final.callPackage ./sourcepawn.nix {};
|
||||||
|
sourcemod-includes = final.callPackage ./sourcemod-includes.nix {};
|
||||||
|
buildSourcePawnScript = final.callPackage ./build-sourcepawn-script.nix {};
|
||||||
|
}
|
||||||
35
pkgs/hl2sdk.nix
Normal file
35
pkgs/hl2sdk.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
{fetchFromGitHub}: let
|
||||||
|
inherit (builtins) mapAttrs;
|
||||||
|
revisions = {
|
||||||
|
csgo = {rev = "4e0975afe5b2994c76ec9b40951b6347b8788463"; sha256 = "sha256-Z5LD3I4uPKGIXTeSC3yQcJl6455XFwQVuiitND8ULEQ=";};
|
||||||
|
tf2 = {rev = "2d3560994fbc31aebbe3a250048bbbc7f76d2803"; sha256 = "sha256-hKwF1cqg08NRPoZk77+lpC2cPMZeKVhsYFpGNi5IH30=";};
|
||||||
|
swarm = {rev = "f6026555a7227b2ff8ebed4f86dd760e50de96db"; sha256 = "sha256-jU3yCEVZUWkiOhqPbbX3oEx26tQaZCpaneMGNSQVnxI=";};
|
||||||
|
portal2 = {rev = "4555a278a5f3a6cf956a0b78f9c481b40664aa4f"; sha256 = "sha256-Zx5d1qhzoqTybFQQWdJw9/QqbnHUcOB3IyRVbZ/5YyA=";};
|
||||||
|
gmod = {rev = "c12fac7c95d9ef5eca89627f944f397af16ae9b4"; sha256 = "sha256-zO1MJIY0ZgHOt9NKtWBi494bOQixk9wo5ybiQI7Esc8=";};
|
||||||
|
nucleardawn = {rev = "568c25dcc3ded2123f851d77f27bf2a3c15382b7"; sha256 = "sha256-81O9XVd39Zq15uiTI4vNVtwTtx/qyyR+xZKNjkEze70=";};
|
||||||
|
orangebox = {rev = "968ec84e340343f42e3d0552dbd74500ef3034d1"; sha256 = "sha256-XZYJvsIeH+Wh5xzTFHm9fB6JPJh1CELIq/F8ERivZcc=";};
|
||||||
|
bgt = {rev = "a9a75c4d74e87d53b190680e4d71e93f59b3539e"; sha256 = "sha256-e7XgRvfWod6gEElNvqLC09HiUy3affoed3eqFOizk/I=";};
|
||||||
|
darkm = {rev = "e659cbdd058fe197a2a5ead4038a591c75063331"; sha256 = "sha256-4RMOMUHLjStsqTMHToxMnxzV2TrP/buiFP3pECYf5IE=";};
|
||||||
|
eye = {rev = "f152e66ac838fb5b8eca1a9076eb26122ac3cb51"; sha256 = "sha256-Zy/rKDKPx3pv9uZD9XhrGBoOiY8/zCBXnc9+LPEwWoQ=";};
|
||||||
|
bms = {rev = "058ed4de4a5db08052937b91798c303bc27b4a14"; sha256 = "sha256-h9+I+lOf4PiTw6U4taQrMLZt1vbPZbucJmf4Td6ltTg=";};
|
||||||
|
l4d = {rev = "a628c16a21f95752d021a16a0c5816ef1f18c37b"; sha256 = "sha256-TqHVJK0nWhg5Gd0KJ4wYQ1Q3QhIidDUxpYSIXKu32G8=";};
|
||||||
|
contagion = {rev = "cbab58f4da31c6a88a4fc1f1bad92dc748343314"; sha256 = "sha256-TitcR3CUHmvlVi6ZlAYC7tojQIldL/01IFHOHiAhev0=";};
|
||||||
|
blade = {rev = "a14ad10afc41d0150ab945cfa1b0e2a64995a503"; sha256 = "sha256-i/1TT/+NJ44Eip9B4RvQFXPd2NQhGBrjgrXdeE+3f7U=";};
|
||||||
|
insurgency = {rev = "29da165490c70f00b2b3d56e38ba97be5287f222"; sha256 = "sha256-ECbTsgbGowUbMhPN5H6sofS5OZRRDmLlNHC/oNkweWE=";};
|
||||||
|
pvkii = {rev = "6769441f9f283c96b3915c5a9399ca8949b1ecb0"; sha256 = "sha256-Z3OYaAuLxBuaznQm6eU0d4dWpOUl1S943b8BazSW6Ug=";};
|
||||||
|
episode1 = {rev = "b3addd57ec0304e03b8a52a5f1f869609538df0a"; sha256 = "sha256-AhjxQ86NEvKwANihD123QSMWrBhw/17mkvcfXQA2q0Q=";};
|
||||||
|
dota = {rev = "8626bfe25f17f98e4a55e71133e1d368780daa37"; sha256 = "sha256-n7HBnEBzf8eBUqOAGZLJWOrPAGNW68nJ9y80OCB0z8c=";};
|
||||||
|
mcv = {rev = "6ef5dfa3f5b504e0ad33dffc1596509caa2cbb04"; sha256 = "sha256-xP2pTBfzNGY/1saGaaISaUp+QKETJjVmhJP50GB9f4c=";};
|
||||||
|
dods = {rev = "d82a11ffc0b3164721f4f919aab289c461e5a375"; sha256 = "sha256-gCbVqyi5Q8zuiTcMMDwb1DUU2XUXiiY+Lxj2wUzM0a8=";};
|
||||||
|
sdk2013 = {rev = "78dab58646d5983c77af44c45a877b89196eb82c"; sha256 = "sha256-2RHuzT6r4WIKYWZaPWFtiDgCAnKgeD9HUyeg1daNCnU=";};
|
||||||
|
hl2dm = {rev = "6f8b684753626bbedc463f2ed5a382ff54e5de3d"; sha256 = "sha256-KMMH0/kM4e1SQ/sr87Bdb81ZwvZoN3N20LrHBMuxNAM=";};
|
||||||
|
l4d2 = {rev = "66743d0eeef0537201104e94affde4e446897822"; sha256 = "sha256-JvcAV6U5hbnfMdOc4YfGLumZqAFWLvnWAFoFUfMgtFQ=";};
|
||||||
|
css = {rev = "ef291082a9efa01225001626e2b14bee8c2c63be"; sha256 = "sha256-x4tZ+fUTb+i2HoKIXgkpXjOUQIWurmHTLyJVuOm/lD0=";};
|
||||||
|
doi = {rev = "a4a0aa9de0a648d7f91fbb9ad8aecb119bd44314"; sha256 = "sha256-qMVHEeJqHyg9Kq1Y2+MNTjChiIUyO6PkbWmKPoGZa/Q=";};
|
||||||
|
};
|
||||||
|
fetchRev = {rev, sha256}: fetchFromGitHub {
|
||||||
|
inherit rev sha256;
|
||||||
|
owner = "alliedmodders";
|
||||||
|
repo = "hl2sdk";
|
||||||
|
};
|
||||||
|
in mapAttrs (key: sdk: fetchRev sdk) revisions
|
||||||
41
pkgs/metamod-source.nix
Normal file
41
pkgs/metamod-source.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{ multiStdenv, fetchFromGitHub, ambuild, git, sdks ? {} }: let
|
||||||
|
inherit (builtins) attrNames concatStringsSep;
|
||||||
|
sdkNames = attrNames sdks;
|
||||||
|
links = map (sdk: "ln -s ${sdks.${sdk}} hl2sdk-${sdk}") sdkNames;
|
||||||
|
in multiStdenv.mkDerivation rec {
|
||||||
|
pname = "metamod-source";
|
||||||
|
version = "1.10";
|
||||||
|
|
||||||
|
NIX_CFLAGS_COMPILE = "-Wno-error=class-memaccess -Wno-error=format-truncation";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "alliedmodders";
|
||||||
|
repo = pname;
|
||||||
|
# rev = version;
|
||||||
|
rev = "b8d1fd401d685fe711ad27e4e169742bd8a51978";
|
||||||
|
sha256 = "sha256-8rQJ99f+XxD+rSP7OpyU5Ml+Wwp/SqJ9+B9EEWmcqDY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
ambuild
|
||||||
|
git
|
||||||
|
];
|
||||||
|
|
||||||
|
hardeningDisable = [ "all" ];
|
||||||
|
|
||||||
|
CFLAGS="-Wno-error=class-memaccess";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
${concatStringsSep "\n" links}
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
python ../configure.py --sdks present --disable-auto-versioning
|
||||||
|
ambuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir $out
|
||||||
|
mv package $out/share
|
||||||
|
cp -r $src $out/include
|
||||||
|
'';
|
||||||
|
}
|
||||||
20
pkgs/sourcemod-includes.nix
Normal file
20
pkgs/sourcemod-includes.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{ stdenv, fetchFromGitHub }:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "sourcemod-includes";
|
||||||
|
version = "1.11";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "alliedmodders";
|
||||||
|
repo = "sourcemod";
|
||||||
|
rev = "39c2dc60e0c0d963cfbe39bee3a7cf953cc8055c";
|
||||||
|
sha256 = "sha256-SwrBuOAebmLq5bgjw5i8CFuEDTtvDqLYY/dk4holrzw=";
|
||||||
|
};
|
||||||
|
|
||||||
|
doConfigure = false;
|
||||||
|
doBuild = false;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir $out
|
||||||
|
cp -r plugins/include $out
|
||||||
|
'';
|
||||||
|
}
|
||||||
43
pkgs/sourcemod.nix
Normal file
43
pkgs/sourcemod.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
{ multiStdenv, fetchFromGitHub, ambuild, metamod-source, git, sdks ? {} }: let
|
||||||
|
inherit (builtins) attrNames concatStringsSep;
|
||||||
|
sdkNames = attrNames sdks;
|
||||||
|
links = map (sdk: "ln -s ${sdks.${sdk}} hl2sdk-${sdk}") sdkNames;
|
||||||
|
metamod-sdks = metamod-source.override {inherit sdks;};
|
||||||
|
in multiStdenv.mkDerivation rec {
|
||||||
|
pname = "sourcemod";
|
||||||
|
version = "1.10";
|
||||||
|
|
||||||
|
NIX_CFLAGS_COMPILE = "-Wno-error=class-memaccess -Wno-error=format-truncation -Wno-error=misleading-indentation";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "alliedmodders";
|
||||||
|
repo = pname;
|
||||||
|
rev = "39c2dc60e0c0d963cfbe39bee3a7cf953cc8055c";
|
||||||
|
sha256 = "sha256-SwrBuOAebmLq5bgjw5i8CFuEDTtvDqLYY/dk4holrzw=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
ambuild
|
||||||
|
git
|
||||||
|
];
|
||||||
|
|
||||||
|
hardeningDisable = [ "all" ];
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
${concatStringsSep "\n" links}
|
||||||
|
ln -s ${metamod-sdks.src} metamod-source
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
python ../configure.py --sdks present --no-mysql --disable-auto-versioning
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
ambuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir $out
|
||||||
|
mv package $out/share
|
||||||
|
'';
|
||||||
|
}
|
||||||
41
pkgs/sourcepawn.nix
Normal file
41
pkgs/sourcepawn.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{ stdenv, fetchFromGitHub, ambuild, python3Packages, buildEnv }:
|
||||||
|
let self = stdenv.mkDerivation rec {
|
||||||
|
pname = "sourcepawn";
|
||||||
|
version = "1.11";
|
||||||
|
|
||||||
|
NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare -Wno-error=unused-but-set-variable -Wno-error=maybe-uninitialized";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "alliedmodders";
|
||||||
|
repo = pname;
|
||||||
|
rev = "9cf9f31d4560fe7e76c6be75a2245088d03a3937";
|
||||||
|
hash = "sha256-lqd6aN5FLCJo8+B+tabABqkkgIFH+o0/0WpnYLse/o4=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
ambuild
|
||||||
|
python3Packages.setuptools
|
||||||
|
];
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
python ../configure.py
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
ambuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp spcomp/*/spcomp spshell/*/spshell verifier/*/verifier $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.buildEnv = imports: buildEnv {
|
||||||
|
name = "sourcepawn-env";
|
||||||
|
paths = imports ++ [self];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in self
|
||||||
Loading…
Add table
Add a link
Reference in a new issue