pinwheel: Use pkgs.buildFHSUserEnv for pants

This commit is contained in:
Alexander Heldt
2024-07-21 10:13:37 +02:00
parent 89f9e6fc29
commit ac279110f5
4 changed files with 38 additions and 161 deletions

134
flake.lock generated
View File

@@ -67,21 +67,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_2"
@@ -100,24 +85,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -199,63 +166,6 @@
"type": "github" "type": "github"
} }
}, },
"nix-alien": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nix-filter": "nix-filter",
"nix-index-database": "nix-index-database",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1718448591,
"narHash": "sha256-TDzUlwvCmkY4IzEMLV7vmB/GlKznsS+/oBO4Z6z9ACE=",
"owner": "thiagokokada",
"repo": "nix-alien",
"rev": "d457975f39a4eaf8bec55b7cc3ff26226d4fb062",
"type": "github"
},
"original": {
"owner": "thiagokokada",
"repo": "nix-alien",
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1710156097,
"narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "3342559a24e85fc164b295c3444e8a139924675b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1718011381,
"narHash": "sha256-sFXI+ZANp/OC+MwfJoZgPSf4xMdtzQMe1pS3FGti4C8=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "88ad3d7501e22b2401dd72734b032b7baa794434",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-index-database",
"type": "github"
}
},
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1720737798, "lastModified": 1720737798,
@@ -274,15 +184,15 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1717786204, "lastModified": 1720768451,
"narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=", "narHash": "sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "051f920625ab5aabe37c920346e3e69d7d34400e", "rev": "7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@@ -304,22 +214,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1720768451,
"narHash": "sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pppdotpm-site": { "pppdotpm-site": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -348,9 +242,8 @@
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"hyprland-contrib": "hyprland-contrib", "hyprland-contrib": "hyprland-contrib",
"nh": "nh", "nh": "nh",
"nix-alien": "nix-alien",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"pppdotpm-site": "pppdotpm-site" "pppdotpm-site": "pppdotpm-site"
} }
}, },
@@ -383,21 +276,6 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -31,11 +31,6 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-alien = {
url = "github:thiagokokada/nix-alien";
inputs.nixpkgs.follows = "nixpkgs";
};
pppdotpm-site = { pppdotpm-site = {
url = "git+ssh://git@codeberg.org/ppp/ppp.pm-site.git?ref=main"; url = "git+ssh://git@codeberg.org/ppp/ppp.pm-site.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View File

@@ -13,11 +13,7 @@ in
home.packages = [ home.packages = [
(pkgs.callPackage ./syb-cli.nix {}) (pkgs.callPackage ./syb-cli.nix {})
(pkgs.callPackage ./pants.nix {})
(pkgs.callPackage ./pants.nix {
nix-alien = inputs.nix-alien.packages."${pkgs.system}".nix-alien;
})
pkgs.unzip # needed by pants
(pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ]) (pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ])
(pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]) (pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ])

View File

@@ -1,39 +1,47 @@
{ {
stdenv,
fetchurl, fetchurl,
writeShellScriptBin, pkgs,
nix-alien, lib,
...
}: }:
let let
version = "0.11.0"; pname = "pants";
version = "0.12.0";
unpatched = stdenv.mkDerivation { scie-pants = pkgs.stdenv.mkDerivation {
name = "scie-pants"; inherit pname version;
version = version;
sourceRoot = ".";
phases = [
"installPhase"
"patchPhase"
];
src = fetchurl { src = fetchurl {
url = "https://github.com/pantsbuild/scie-pants/releases/download/v${version}/scie-pants-linux-x86_64"; url = "https://github.com/pantsbuild/scie-pants/releases/download/v${version}/scie-${pname}-linux-x86_64";
sha256 = "sha256-ifP5gjTdLMXyVSKda6pPBNNcnJZ0giuqikFBk7cXgHI="; hash = "sha256-9PjgobndxVqDTYGtw1HESrtzwzH2qE9zFwR26xtwZrM=";
}; };
phases = ["installPhase" "patchPhase"];
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
cp $src $out/bin/pants cp $src $out/bin/pants
chmod +x $out/bin/pants chmod +x $out/bin/pants
runHook postInstall
''; '';
}; };
in in
writeShellScriptBin "pants" '' pkgs.buildFHSUserEnv {
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH name = "pants";
${nix-alien}/bin/nix-alien ${unpatched}/bin/pants -- "$@"
'' targetPackages = with pkgs; [
python39
];
runScript = "${scie-pants}/bin/pants";
profile = ''
export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
export SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
'';
meta = with lib; {
description = "Protects your Pants from the elements";
homepage = "https://github.com/pantsbuild/scie-pants";
license = licenses.asl20;
maintainers = [];
platforms = [ "x86_64-linux" ];
mainProgram = "pants";
};
}