70 lines
1.7 KiB
Nix
70 lines
1.7 KiB
Nix
{
|
|
system,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
version = "0.12.0";
|
|
|
|
if_let = v: p: if lib.attrsets.matchAttrs p v then v else null;
|
|
match =
|
|
v: l: builtins.elemAt (lib.lists.findFirst (x: (if_let v (builtins.elemAt x 0)) != null) null l) 1;
|
|
|
|
package = match { platform = system; } [
|
|
[
|
|
{ platform = "aarch64-linux"; }
|
|
{
|
|
url = "https://github.com/pantsbuild/scie-pants/releases/download/v${version}/scie-pants-linux-aarch64";
|
|
hash = lib.fakeSha256;
|
|
}
|
|
]
|
|
[
|
|
{ platform = "x86_64-linux"; }
|
|
{
|
|
url = "https://github.com/pantsbuild/scie-pants/releases/download/v${version}/scie-pants-linux-x86_64";
|
|
hash = "sha256-9PjgobndxVqDTYGtw1HESrtzwzH2qE9zFwR26xtwZrM=";
|
|
}
|
|
]
|
|
[
|
|
{ platform = "aarch64-darwin"; }
|
|
{
|
|
url = "https://github.com/pantsbuild/scie-pants/releases/download/v${version}/scie-pants-macos-aarch64";
|
|
hash = "sha256-1Ha8GAOl7mWVunGKf7INMjar+jnLXaDEPStqE+kK3D4=";
|
|
}
|
|
]
|
|
];
|
|
|
|
unpatched = pkgs.stdenv.mkDerivation {
|
|
name = "scie-pants";
|
|
version = version;
|
|
sourceRoot = ".";
|
|
phases = [
|
|
"installPhase"
|
|
"patchPhase"
|
|
];
|
|
|
|
src = pkgs.fetchurl package;
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
cp $src $out/bin/pants
|
|
chmod +x $out/bin/pants
|
|
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
|
|
patched = pkgs.buildFHSEnv {
|
|
name = "pants";
|
|
targetPackages = [ pkgs.python39 ];
|
|
runScript = "${unpatched}/bin/pants";
|
|
profile = ''
|
|
export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
|
|
export SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
|
|
'';
|
|
};
|
|
in
|
|
if pkgs.stdenv.isDarwin then unpatched else patched
|