packages/pin: init

This commit is contained in:
Max Headroom 2022-07-30 19:39:22 +02:00
parent 1718e6c2a8
commit cc6dcc4d8f
3 changed files with 37 additions and 3 deletions

View file

@ -2,6 +2,7 @@
let
inherit (pkgs) lib;
inherit (inputs) unstable;
inherit (inputs.self.packages.${system}) nix-super;
pins = import ./sources;
@ -48,9 +49,7 @@ in
ipfs = pkgs.callPackage ./networking/ipfs { };
npins = let
inherit (inputs.self.packages.${system}) nix-super;
in pkgs.callPackage ./tools/npins {
npins = pkgs.callPackage ./tools/npins {
nix = nix-super;
nix-prefetch-git = pkgs.nix-prefetch-git.override {
nix = nix-super;
@ -59,6 +58,11 @@ in
opentelemetry-java-agent-bin = pkgs.callPackage ./monitoring/opentelemetry-java-agent-bin { };
pin = pkgs.callPackage ./tools/pin {
inherit npins;
nix = nix-super;
};
privatevoid-smart-card-ca-bundle = pkgs.callPackage ./data/privatevoid-smart-card-certificate-authority-bundle.nix { };
reflex-cache = poetry2nix.mkPoetryApplication {

View file

@ -0,0 +1,13 @@
{
writeShellApplication,
nix, npins
}:
writeShellApplication {
name = "pin";
runtimeInputs = [
nix
npins
];
text = builtins.readFile ./pin.sh;
}

17
packages/tools/pin/pin.sh Normal file
View file

@ -0,0 +1,17 @@
REPO_ROOT="${REPO_ROOT:-.}"
NPINS_DIRECTORY="${NPINS_DIRECTORY:-npins}"
cmd="$1"
shift
case $cmd in
update)
for pkg in "$@"; do
oldver=$(nix eval --raw "${REPO_ROOT}#${pkg}.version")
npins update "$pkg"
newver=$(nix eval --raw "${REPO_ROOT}#${pkg}.version")
git add "${NPINS_DIRECTORY}"
git commit "${NPINS_DIRECTORY}" -m "packages/$pkg: $oldver -> $newver"
done;;
*)
echo Unknown command: "$cmd";;
esac