just.setupHook: init

Adapted from the Ninja setup hook. This will mean that adding just to
nativeBuildInputs is enough to have a package be automatically built
with it, matching make, bmake, ninja, etc.

Currently, we have two packages in Nixpkgs that use just, dogdns and
kabeljau. kabeljau follows the expected conventions, while dogdns
does not. I expect there to be more packages using just in future,
following these conventions, because all of the packages in system76's
in-progress COSMIC desktop environment use just, and follow the
conventions.

+64
+2
pkgs/development/tools/just/default.nix
··· 72 --zsh completions/just.zsh 73 ''; 74 75 passthru.updateScript = nix-update-script { }; 76 77 meta = with lib; {
··· 72 --zsh completions/just.zsh 73 ''; 74 75 + setupHook = ./setup-hook.sh; 76 + 77 passthru.updateScript = nix-update-script { }; 78 79 meta = with lib; {
+58
pkgs/development/tools/just/setup-hook.sh
···
··· 1 + justBuildPhase() { 2 + runHook preBuild 3 + 4 + local flagsArray=($justFlags "${justFlagsArray[@]}") 5 + 6 + echoCmd 'build flags' "${flagsArray[@]}" 7 + just "${flagsArray[@]}" 8 + 9 + runHook postBuild 10 + } 11 + 12 + justCheckPhase() { 13 + runHook preCheck 14 + 15 + if [ -z "${checkTarget:-}" ]; then 16 + if just -n test >/dev/null 2>&1; then 17 + checkTarget=test 18 + fi 19 + fi 20 + 21 + if [ -z "${checkTarget:-}" ]; then 22 + echo "no test target found in just, doing nothing" 23 + else 24 + local flagsArray=( 25 + $justFlags "${justFlagsArray[@]}" 26 + $checkTarget 27 + ) 28 + 29 + echoCmd 'check flags' "${flagsArray[@]}" 30 + just "${flagsArray[@]}" 31 + fi 32 + 33 + runHook postCheck 34 + } 35 + 36 + justInstallPhase() { 37 + runHook preInstall 38 + 39 + # shellcheck disable=SC2086 40 + local flagsArray=($justFlags "${justFlagsArray[@]}" ${installTargets:-install}) 41 + 42 + echoCmd 'install flags' "${flagsArray[@]}" 43 + just "${flagsArray[@]}" 44 + 45 + runHook postInstall 46 + } 47 + 48 + if [ -z "${dontUseJustBuild-}" -a -z "${buildPhase-}" ]; then 49 + buildPhase=justBuildPhase 50 + fi 51 + 52 + if [ -z "${dontUseJustCheck-}" -a -z "${checkPhase-}" ]; then 53 + checkPhase=justCheckPhase 54 + fi 55 + 56 + if [ -z "${dontUseJustInstall-}" -a -z "${installPhase-}" ]; then 57 + installPhase=justInstallPhase 58 + fi
+4
pkgs/tools/networking/dogdns/default.nix
··· 41 }; 42 }; 43 44 postPatch = '' 45 # update Cargo.lock to work with openssl 3 46 ln -sf ${./Cargo.lock} Cargo.lock
··· 41 }; 42 }; 43 44 + dontUseJustBuild = true; 45 + dontUseJustCheck = true; 46 + dontUseJustInstall = true; 47 + 48 postPatch = '' 49 # update Cargo.lock to work with openssl 3 50 ln -sf ${./Cargo.lock} Cargo.lock