refactor(ariadne): move extraction tools to nix file
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
sh_binary(
|
||||
name = "extract_and_decompile",
|
||||
srcs = ["extract-and-decompile.sh"],
|
||||
data = ["extract-tools.nix"],
|
||||
)
|
||||
|
||||
@@ -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`.
|
||||
Use the game installation directory as the game root.
|
||||
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.
|
||||
Bazel owns stable inputs and wrappers.
|
||||
|
||||
@@ -46,45 +46,20 @@ enter_nix_shell_if_needed() {
|
||||
|
||||
require_tool nix
|
||||
|
||||
local rpycdec_installable
|
||||
rpycdec_installable=$(cat <<'NIX'
|
||||
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
|
||||
];
|
||||
}
|
||||
NIX
|
||||
)
|
||||
local tools_nix
|
||||
if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
|
||||
tools_nix=$BUILD_WORKSPACE_DIRECTORY/src/ariadne/extract-tools.nix
|
||||
else
|
||||
tools_nix=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/extract-tools.nix
|
||||
fi
|
||||
|
||||
[[ -f "$tools_nix" ]] || fail "missing Ariadne tool definition: $tools_nix"
|
||||
|
||||
say "entering Nix shell for rpycdec"
|
||||
export ARIADNE_NIX_SHELL=1
|
||||
exec nix shell \
|
||||
--extra-experimental-features 'nix-command flakes' \
|
||||
--impure \
|
||||
--expr "$rpycdec_installable" \
|
||||
--file "$tools_nix" \
|
||||
--command bash "$0" "$@"
|
||||
}
|
||||
|
||||
|
||||
28
src/ariadne/extract-tools.nix
Normal file
28
src/ariadne/extract-tools.nix
Normal 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
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user