Adds `crucible nwsync emit` and `crucible nwsync assemble`, the split replacement for upstream nwn_nwsync_write, which cannot be used because it wants every hak, the TLK and the module present in one run on one disk. emit explodes one artifact — a .hak/.erf or a loose file such as the TLK — into NWSync blobs (NWCompressedBuffer framing, magic NSYC, zstd) plus a NSYM v3 manifest describing only that artifact, with the same .json sidecar upstream writes. Blob names are the sha1 of the uncompressed bytes, restypes nss/ndb/gic are always skipped, an unresolvable restype is a hard error, a resource over 15 MB fails closed, and no latest or .origin file is ever written. assemble merges the per-artifact manifests into one, reading no bulk data. The merge rule is resref shadowing, not concatenation: a resref present in more than one artifact resolves to the earliest artifact in --order, the way the game resolves it. It refuses to merge across mismatched emitter versions, and takes --group-id from the caller (1 current, 2 testing; 0 is absent). Refs #53.
90 lines
2.9 KiB
Nix
90 lines
2.9 KiB
Nix
{
|
|
description = "sow-tools / Crucible — NWN build/conversion/sync toolchain (self-contained Go devshell)";
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
|
in
|
|
{
|
|
# Self-contained (D8): a host with ONLY nix can enter this shell and run
|
|
# `make check`.
|
|
# Daemonless image build (D8): `nix build .#image` produces an OCI tarball
|
|
# with no docker/podman daemon. CI loads/pushes it with skopeo. This is the
|
|
# Nix-native replacement for `docker build` on the host-mode runner, which
|
|
# has no container runtime.
|
|
packages = forAllSystems (pkgs:
|
|
let
|
|
version = self.shortRev or self.dirtyShortRev or "unknown";
|
|
crucible = pkgs.buildGoModule {
|
|
pname = "crucible";
|
|
inherit version;
|
|
src = ./.;
|
|
vendorHash = "sha256-0I8j7On9YGD2GK9xbj/KkgBrlkMJ6Y6XQv+KCLTgBBU=";
|
|
subPackages = [
|
|
"cmd/crucible"
|
|
"cmd/crucible-depot"
|
|
"cmd/crucible-hak"
|
|
"cmd/crucible-module"
|
|
"cmd/crucible-topdata"
|
|
"cmd/crucible-wiki"
|
|
];
|
|
env.CGO_ENABLED = 0;
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/buildinfo.Version=${version}"
|
|
];
|
|
# Unit tests run in the `test` workflow / `make check`, not here.
|
|
doCheck = false;
|
|
};
|
|
in
|
|
{
|
|
inherit crucible;
|
|
default = crucible;
|
|
|
|
image = pkgs.dockerTools.buildLayeredImage {
|
|
name = "registry.westgate.pw/deployment/crucible";
|
|
tag = version;
|
|
contents = [ crucible pkgs.cacert pkgs.fakeNss ];
|
|
config = {
|
|
Entrypoint = [ "/bin/crucible" ];
|
|
Cmd = [ "help" ];
|
|
User = "65532:65532";
|
|
Env = [
|
|
"PATH=/bin"
|
|
"SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
|
|
];
|
|
};
|
|
};
|
|
});
|
|
|
|
devShells = forAllSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
name = "sow-tools";
|
|
packages = with pkgs; [
|
|
go
|
|
gopls
|
|
gotools
|
|
git
|
|
tea
|
|
gnumake
|
|
bashInteractive
|
|
shellcheck
|
|
yamllint
|
|
jq
|
|
];
|
|
shellHook = ''
|
|
export GOCACHE="$PWD/.cache/go-build"
|
|
echo "sow-tools / Crucible devshell (self-contained). $(go version 2>/dev/null)"
|
|
echo " make check go vet + go test + shellcheck + yamllint"
|
|
echo " make build build every cmd/* into ./bin"
|
|
echo " make smoke build + run the binary smoke test"
|
|
'';
|
|
};
|
|
});
|
|
};
|
|
}
|