refactor(ariadne): move extraction tools to nix file

This commit is contained in:
2026-09-05 18:47:52 -04:00
parent f4049b2968
commit 31faf6737f
4 changed files with 39 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
sh_binary( sh_binary(
name = "extract_and_decompile", name = "extract_and_decompile",
srcs = ["extract-and-decompile.sh"], srcs = ["extract-and-decompile.sh"],
data = ["extract-tools.nix"],
) )

View File

@@ -18,7 +18,7 @@ The script defaults to `<workspace>/src/ariadne/output`.
This path stays stable when you run the command from inside `src/ariadne`. This path stays stable when you run the command from inside `src/ariadne`.
Use the game installation directory as the game root. Use the game installation directory as the game root.
One run processes all installed season directories. One run processes all installed season directories.
If `rpycdec` is not available, the script re-runs itself inside a Nix shell. If `rpycdec` is not available, the script uses `extract-tools.nix` to enter a Nix shell.
Keep the script as a thin orchestration layer. Keep the script as a thin orchestration layer.
Bazel owns stable inputs and wrappers. Bazel owns stable inputs and wrappers.

View File

@@ -46,45 +46,20 @@ enter_nix_shell_if_needed() {
require_tool nix require_tool nix
local rpycdec_installable local tools_nix
rpycdec_installable=$(cat <<'NIX' if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
let tools_nix=$BUILD_WORKSPACE_DIRECTORY/src/ariadne/extract-tools.nix
pkgs = import (builtins.getFlake "nixpkgs") { system = builtins.currentSystem; }; else
rpycdec = pkgs.python3Packages.buildPythonApplication { tools_nix=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/extract-tools.nix
pname = "rpycdec"; fi
version = "0.0.0+1000bd1";
pyproject = true; [[ -f "$tools_nix" ]] || fail "missing Ariadne tool definition: $tools_nix"
src = pkgs.fetchFromGitHub {
owner = "cnfatal";
repo = "rpycdec";
rev = "1000bd1da10ef07e82f6fa560c621e6a4b55d1b8";
hash = "sha256-VoVbIKs8xz5x2s0OGqdHbY55fWDruqMAX8YYjEQhwTQ=";
};
nativeBuildInputs = with pkgs.python3Packages; [
hatch-vcs
hatchling
];
env.SETUPTOOLS_SCM_PRETEND_VERSION_FOR_RPYCDEC = "0.0.0+1000bd1";
};
in
pkgs.buildEnv {
name = "ariadne-extract-and-decompile-tools";
paths = [
pkgs.bash
pkgs.coreutils
pkgs.findutils
rpycdec
];
}
NIX
)
say "entering Nix shell for rpycdec" say "entering Nix shell for rpycdec"
export ARIADNE_NIX_SHELL=1 export ARIADNE_NIX_SHELL=1
exec nix shell \ exec nix shell \
--extra-experimental-features 'nix-command flakes' \ --extra-experimental-features 'nix-command flakes' \
--impure \ --file "$tools_nix" \
--expr "$rpycdec_installable" \
--command bash "$0" "$@" --command bash "$0" "$@"
} }

View File

@@ -0,0 +1,28 @@
let
pkgs = import (builtins.getFlake "nixpkgs") { system = builtins.currentSystem; };
rpycdec = pkgs.python3Packages.buildPythonApplication {
pname = "rpycdec";
version = "0.0.0+1000bd1";
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "cnfatal";
repo = "rpycdec";
rev = "1000bd1da10ef07e82f6fa560c621e6a4b55d1b8";
hash = "sha256-VoVbIKs8xz5x2s0OGqdHbY55fWDruqMAX8YYjEQhwTQ=";
};
nativeBuildInputs = with pkgs.python3Packages; [
hatch-vcs
hatchling
];
env.SETUPTOOLS_SCM_PRETEND_VERSION_FOR_RPYCDEC = "0.0.0+1000bd1";
};
in
pkgs.buildEnv {
name = "ariadne-extract-and-decompile-tools";
paths = [
pkgs.bash
pkgs.coreutils
pkgs.findutils
rpycdec
];
}