{
pkgs ? import <nixpkgs> { },
}:
let
inherit (pkgs) lib;
# non-flake eval has no git-tree filter and the repo collects state that
# must not reach the store: the stray root `tobi` binary from `go build`
# and the churn-heavy .jj dir of the colocated jj checkout
src = lib.cleanSourceWith {
src = lib.cleanSource ./.;
filter = path: type:
!(type == "directory" && baseNameOf path == ".jj")
&& (type == "directory" || baseNameOf path != "tobi");
};
in
pkgs.buildGoModule {
pname = "tobi";
version = "0.1.0";
inherit src;
vendorHash = "sha256-z1woMVs6DtFaiCvOYa+RiKJX6KlrR3q5aUlbeT6RkFM=";
nativeBuildInputs = [ pkgs.zstd ];
# one build path shared with manual runs
buildPhase = ''
runHook preBuild
bash scripts/build-universal.sh ./dist
runHook postBuild
'';
# the checkPhase would call getGoDirs, which lives in the default buildPhase
# this package replaces
doCheck = false;
installPhase = ''
runHook preInstall
install -Dm755 ./dist/tobi $out/bin/tobi
install -Dm644 contrib/tobi.nu $out/share/nushell/vendor/autoload/tobi.nu
runHook postInstall
'';
}