nix/flake.nix
2026-07-09 20:02:41 +02:00

98 lines
2.8 KiB
Nix

{
inputs = {
nixpkgs.url = "nixpkgs/nixos-26.05";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
steam-fetcher = {
url = "github:nix-community/steam-fetcher";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
flakelight,
steam-fetcher,
...
}: let
inherit (builtins) listToAttrs map;
inheritPkgs = names:
listToAttrs (map (name: {
inherit name;
value = {pkgs, ...}: pkgs.${name};
})
names);
in
flakelight ./. {
nixpkgs.config = {allowUnfree = true;};
systems = ["x86_64-linux" "i686-linux"];
withOverlays = [
steam-fetcher.overlay
(import ./nix/overlay.nix)
];
formatters = pkgs:
with pkgs; {
"*.nix" = pkgs.lib.getExe alejandra;
};
perSystem = pkgs: {
sourcemods = pkgs.lib.mapAttrs (name: sdk: pkgs.sourcemod-builder {${name} = sdk;}) pkgs.hl2sdk;
metamods = pkgs.lib.mapAttrs (name: sdk: pkgs.metamod-source-builder {${name} = sdk;}) pkgs.hl2sdk;
hl2sdk = pkgs.hl2sdk;
steam-depots = pkgs.steam-depots;
};
packages =
inheritPkgs [
"ambuild"
"sourcepawn"
"sourcemod"
"srctvplus"
"sourcemod-includes"
"sourcemod-include-curl"
"sourcemod-include-library"
"sourcemod-include-steamworks"
"srcds-tf2"
"sourcemod-plugin-steamworks"
"sourcemod-plugin-soap-tf2dm"
"sourcemod-plugin-progressive-ruleset-timer"
"sourcemod-plugin-socket"
"sourcemod-plugin-tf2-comp-fixes"
]
// {
test = pkgs:
pkgs.srcds-tf2.customize {
cfg = {
hostname = "Spire Server";
};
sourcemod = true;
};
testScript = pkgs:
pkgs.buildSourcePawnScript {
name = "test";
src = pkgs.fetchurl {
url = "https://codeberg.org/spire/nocheats/raw/commit/5e0e21c241fdf8907d83d9bcf3cce37711b83d14/plugin/nocheats.sp";
sha256 = "sha256-Z3RJhuc9c8YQTo9gnLTBrqL4JpADZgDttrJVyE/MWdM=";
};
};
};
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=";
};
};
};
devShells.default = {pkgs, ...}: {
packages = with pkgs; [nix-update depotdownloader];
};
};
}