git.delta.rocks / jrsonnet / refs/commits / be638810f878

difftreelog

source

nix/jrsonnet-cross-darwin.nix1.2 KiBsourcehistory
1{2  lib,3  craneLib,4  cargo-zigbuild,5  zig,6  darwin,7  targetTriple,8  withExperimentalFeatures ? false,9}:10let11  inherit (lib) optionalString;12in13craneLib.buildPackage {14  src = lib.cleanSourceWith {15    src = ../.;16    filter = path: type: (lib.hasSuffix ".jsonnet" path) || (craneLib.filterCargoSources path type);17  };18  pname = "jrsonnet";19  version = "current${optionalString withExperimentalFeatures "-experimental"}";20  strictDeps = true;2122  depsBuildBuild = [23    zig24    cargo-zigbuild25  ];2627  nativeBuildInputs = [28    darwin.xcode_12_229  ];3031  cargoExtraArgs = "-p jrsonnet";3233  buildPhaseCargoCommand = ''34    export SDKROOT=${darwin.xcode_12_2}/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk35    export XDG_CACHE_HOME=$TMPDIR/xdg_cache36    mkdir -p $XDG_CACHE_HOME37    export CARGO_ZIGBUILD_CACHE_DIR=$TMPDIR/cargo-zigbuild-cache38    mkdir -p $CARGO_ZIGBUILD_CACHE_DIR3940    HOME=$(mktemp -d)41    cargo zigbuild --release --locked ${optionalString withExperimentalFeatures "--features=experimental"} --target=${targetTriple}42  '';4344  doNotPostBuildInstallCargoBinaries = true;45  installPhaseCommand = ''46    mkdir -p $out/bin47    cp target/${targetTriple}/release/jrsonnet $out/bin/jrsonnet48  '';49}