pinwheel: Add pants for work
This commit is contained in:
@@ -17,6 +17,7 @@ in
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
# (pkgs.callPackage ./pants.nix { inherit (pkgs) system; })
|
||||
(pkgs.callPackage ./syb-cli.nix { })
|
||||
|
||||
(pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ])
|
||||
|
||||
69
hosts/pinwheel/modules/work/pants.nix
Normal file
69
hosts/pinwheel/modules/work/pants.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
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
|
||||
Reference in New Issue
Block a user