sts2-bot/flake.nix

55 lines
1.9 KiB
Nix

{
description = "STS2 bot development and offline checks";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { nixpkgs, ... }:
let
systems = [ "x86_64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
packagesFor = system: import nixpkgs { inherit system; };
in
{
devShells = forAllSystems (system:
let pkgs = packagesFor system;
in {
default = pkgs.mkShellNoCC {
packages = with pkgs; [ python3 dotnet-sdk_9 git jujutsu curl bash ];
DOTNET_CLI_TELEMETRY_OPTOUT = "1";
DOTNET_NOLOGO = "1";
};
});
checks = forAllSystems (system:
let pkgs = packagesFor system;
in {
offline = pkgs.runCommand "sts2-offline-checks" {
nativeBuildInputs = [ pkgs.python3 pkgs.bash ];
# Explicit inputs exclude credentials, local captures, game binaries,
# and submodules. Only the committed regression fixtures are needed.
source = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./facts.py ./brain.py ./jev.py ./sts2.py ./run.py
./run_state.py ./recording.py ./migrate.py ./policy
./test_facts.py ./test_brain.py ./test_run.py
./eval_batch.sh ./ab_card_skip.sh
./dataset ./capture/09_now.json
];
};
} ''
export HOME="$TMPDIR/home"
mkdir -p "$HOME"
cp -R "$source" source
chmod -R u+w source
cd source
python3 test_facts.py
python3 test_brain.py
python3 test_run.py
python3 migrate.py --check-only
bash -n eval_batch.sh ab_card_skip.sh
touch "$out"
'';
});
};
}