flake reorg

This commit is contained in:
Robin Appelman 2025-06-19 23:08:16 +02:00
commit 67537a38e0
15 changed files with 70 additions and 96 deletions

View file

@ -12,7 +12,7 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#ambuild
sdk-matrix:
@ -38,8 +38,9 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#packages.${{ matrix.system }}.sourcemods.${{ matrix.sdk }}
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run:
nix build .#packages.${{ matrix.system }}.sourcemods.${{ matrix.sdk }}
sourcepawn:
runs-on: ubuntu-latest
@ -51,7 +52,7 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#sourcepawn
- name: Compile test script
run: nix build .#buildTestScript

View file

@ -12,11 +12,11 @@ The following is currently packaged:
- `sourcemod`
- [`sourcemod-include-library`](https://github.com/JoinedSenses/SourceMod-IncludeLibrary)
## 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.
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;};};
@ -26,7 +26,8 @@ pkgs.sourcemod.override {sdks = {inherit (pkgs.hl2sdk) tf2;};};
#### i686-linux
`episode1`, `ep2`, `css`, `hl2dm`, `dods`, `sdk2013`, `tf2`, `l4d`, `l4d2`, `nucleardawn`, `csgo`, `insurgency`, `bms` and `doi`
`episode1`, `ep2`, `css`, `hl2dm`, `dods`, `sdk2013`, `tf2`, `l4d`, `l4d2`,
`nucleardawn`, `csgo`, `insurgency`, `bms` and `doi`
#### x86_64-linux
@ -43,8 +44,9 @@ buildSourcePawnScript {
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.
A helper is provided to create include packages:
Additional includes can be added by setting the `includes` argument to an array
of packages containing an `include` folder containing the `.inc` files. A helper
is provided to create include packages:
```nix
sourcepawn.buildInclude [./cURL.inc ./cURL_header.inc]

73
flake.lock generated
View file

@ -1,57 +1,42 @@
{
"nodes": {
"nixpkgs": {
"flakelight": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1746301764,
"narHash": "sha256-5odz+NZszRya//Zd0P8h+sIwOnV35qJi+73f4I+iv1M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "537ee98218704e21ea465251de512ab6bbb9012e",
"lastModified": 1750078272,
"narHash": "sha256-Mbu2+ipXe1tAW3UjWXzlDE3wzyVDMOcW1z/PgGmq5T4=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "38be6514d41071863d2a9a2f38f6f3b3433c69fb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "release-24.11",
"type": "indirect"
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1750134718,
"narHash": "sha256-v263g4GbxXv87hMXMCpjkIxd/viIF7p3JpJrwgKdNiI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9e83b64f727c88a7711a2c463a7b16eedb69a84c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"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": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
"flakelight": "flakelight"
}
}
},

View file

@ -1,55 +1,41 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/release-24.11";
flakelight.url = "github:nix-community/flakelight";
};
outputs = {
self,
nixpkgs,
utils,
}: let
inherit (nixpkgs.lib.lists) concatMap;
inherit (builtins) map;
systems = with utils.lib.system; [x86_64-linux i686-linux];
outputs = {flakelight, ...}: let
inherit (builtins) listToAttrs map;
inheritPkgs = names:
listToAttrs (map (name: {
inherit name;
value = {pkgs, ...}: pkgs.${name};
})
names);
in
utils.lib.eachSystem systems (system: let
inherit (builtins) mapAttrs attrNames elem;
inherit (pkgs) lib;
inherit (lib.attrsets) filterAttrs;
overlays = [(import ./pkgs)];
pkgs = (import nixpkgs) {
inherit system overlays;
# crossSystem = { config = "i686-unknown-linux-gnu"; };
};
testScript = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/spiretf/nocheats/master/plugin/nocheats.sp";
sha256 = "sha256-Z3RJhuc9c8YQTo9gnLTBrqL4JpADZgDttrJVyE/MWdM=";
};
platformSdks = filterAttrs (name: sdk: elem system sdk.meta.platforms) pkgs.hl2sdk;
in rec {
packages = rec {
inherit (pkgs) ambuild sourcemod sourcepawn sourcemod-includes buildSourcePawnScript hl2sdk sourcemod-include-library;
sourcemods = mapAttrs (name: sdk: pkgs.sourcemod.override {sdks = {${name} = sdk;};}) hl2sdk;
buildTestScript = buildSourcePawnScript {
name = "test";
src = testScript;
flakelight ./. {
systems = ["x86_64-linux" "i686-linux"];
withOverlays = [(import ./nix/overlay.nix)];
formatters = pkgs:
with pkgs; {
"*.nix" = pkgs.lib.getExe alejandra;
};
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [clangStdenv];
perSystem = pkgs: {
sourcemods = pkgs.lib.mapAttrs (name: sdk: pkgs.sourcemod.override {sdks = {${name} = sdk;};}) pkgs.hl2sdk;
metamods = pkgs.lib.mapAttrs (name: sdk: pkgs.metamod-source.override {sdks = {${name} = sdk;};}) pkgs.hl2sdk;
};
packages = inheritPkgs ["ambuild" "sourcemod" "sourcepawn" "sourcemod-includes" "sourcemod-include-library"];
sdks = attrNames platformSdks;
overlays.default = import ./pkgs;
})
// {
matrix = {
include = concatMap (system: map (sdk: {inherit system sdk;}) self.sdks.${system}) systems;
checks = {
buildTestScript = {pkgs, ...}:
pkgs.buildSourcePawnScript {
name = "test";
src = pkgs.fetchurl {
url = "https://codeberg.org/spire/nocheats/raw/commit/5e0e21c241fdf8907d83d9bcf3cce37711b83d14/plugin/nocheats.sp";
sha256 = "sha256-Z3RJhuc9c8YQTo9gnLTBrqL4JpADZgDttrJVyE/MWdM=";
};
};
};
overlays.default = import ./pkgs;
inherit systems;
};
}

View file

@ -2,7 +2,7 @@
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "sourcemod-include-curl";
version = "2.0.0-beta";

View file

@ -2,7 +2,7 @@
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "sourcemod-include-library";
version = "19-10-2022";

View file

@ -2,7 +2,7 @@
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "sourcemod-includes";
version = "1.11";

View file

@ -2,7 +2,7 @@
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "sourcemod-include-steamworks";
version = "1.2.3c";