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

View file

@ -12,11 +12,11 @@ The following is currently packaged:
- `sourcemod` - `sourcemod`
- [`sourcemod-include-library`](https://github.com/JoinedSenses/SourceMod-IncludeLibrary) - [`sourcemod-include-library`](https://github.com/JoinedSenses/SourceMod-IncludeLibrary)
## Sourcemod SDKs ## Sourcemod SDKs
For the `sourcemod` package, you need to enable one or more SDKs at build time. 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 ```nix
pkgs.sourcemod.override {sdks = {inherit (pkgs.hl2sdk) tf2;};}; pkgs.sourcemod.override {sdks = {inherit (pkgs.hl2sdk) tf2;};};
@ -26,7 +26,8 @@ pkgs.sourcemod.override {sdks = {inherit (pkgs.hl2sdk) tf2;};};
#### i686-linux #### 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 #### x86_64-linux
@ -43,9 +44,10 @@ buildSourcePawnScript {
By default, the sourcemod includes are available. 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. Additional includes can be added by setting the `includes` argument to an array
A helper is provided to create include packages: of packages containing an `include` folder containing the `.inc` files. A helper
is provided to create include packages:
```nix ```nix
sourcepawn.buildInclude [./cURL.inc ./cURL_header.inc] sourcepawn.buildInclude [./cURL.inc ./cURL_header.inc]
``` ```

73
flake.lock generated
View file

@ -1,57 +1,42 @@
{ {
"nodes": { "nodes": {
"nixpkgs": { "flakelight": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": { "locked": {
"lastModified": 1746301764, "lastModified": 1750078272,
"narHash": "sha256-5odz+NZszRya//Zd0P8h+sIwOnV35qJi+73f4I+iv1M=", "narHash": "sha256-Mbu2+ipXe1tAW3UjWXzlDE3wzyVDMOcW1z/PgGmq5T4=",
"owner": "NixOS", "owner": "nix-community",
"repo": "nixpkgs", "repo": "flakelight",
"rev": "537ee98218704e21ea465251de512ab6bbb9012e", "rev": "38be6514d41071863d2a9a2f38f6f3b3433c69fb",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "nix-community",
"ref": "release-24.11", "repo": "flakelight",
"type": "indirect" "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": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "flakelight": "flakelight"
"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"
} }
} }
}, },

View file

@ -1,55 +1,41 @@
{ {
inputs = { inputs = {
utils.url = "github:numtide/flake-utils"; flakelight.url = "github:nix-community/flakelight";
nixpkgs.url = "nixpkgs/release-24.11";
}; };
outputs = { outputs = {flakelight, ...}: let
self, inherit (builtins) listToAttrs map;
nixpkgs, inheritPkgs = names:
utils, listToAttrs (map (name: {
}: let inherit name;
inherit (nixpkgs.lib.lists) concatMap; value = {pkgs, ...}: pkgs.${name};
inherit (builtins) map; })
systems = with utils.lib.system; [x86_64-linux i686-linux]; names);
in in
utils.lib.eachSystem systems (system: let flakelight ./. {
inherit (builtins) mapAttrs attrNames elem; systems = ["x86_64-linux" "i686-linux"];
inherit (pkgs) lib; withOverlays = [(import ./nix/overlay.nix)];
inherit (lib.attrsets) filterAttrs;
overlays = [(import ./pkgs)]; formatters = pkgs:
pkgs = (import nixpkgs) { with pkgs; {
inherit system overlays; "*.nix" = pkgs.lib.getExe alejandra;
# 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;
}; };
};
devShells.default = pkgs.mkShell { perSystem = pkgs: {
nativeBuildInputs = with pkgs; [clangStdenv]; 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; checks = {
buildTestScript = {pkgs, ...}:
overlays.default = import ./pkgs; pkgs.buildSourcePawnScript {
}) name = "test";
// { src = pkgs.fetchurl {
matrix = { url = "https://codeberg.org/spire/nocheats/raw/commit/5e0e21c241fdf8907d83d9bcf3cce37711b83d14/plugin/nocheats.sp";
include = concatMap (system: map (sdk: {inherit system sdk;}) self.sdks.${system}) systems; sha256 = "sha256-Z3RJhuc9c8YQTo9gnLTBrqL4JpADZgDttrJVyE/MWdM=";
};
};
}; };
overlays.default = import ./pkgs;
inherit systems;
}; };
} }

View file

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

View file

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

View file

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

View file

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