From 1faea2934b9a46d0fbf1a605a01c356f9d0da94a Mon Sep 17 00:00:00 2001 From: Tim Cuthbertson Date: Sun, 22 Apr 2018 10:28:11 +1000 Subject: [PATCH] nix-pin: 0.1.2 -> 0.2.2 and add updateScript --- .../package-management/nix-pin/default.nix | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/package-management/nix-pin/default.nix b/pkgs/tools/package-management/nix-pin/default.nix index c12b82a61e17..bb3a1faa0c3b 100644 --- a/pkgs/tools/package-management/nix-pin/default.nix +++ b/pkgs/tools/package-management/nix-pin/default.nix @@ -1,12 +1,12 @@ { pkgs, stdenv, fetchFromGitHub, mypy, python3 }: let self = stdenv.mkDerivation rec { name = "nix-pin-${version}"; - version = "0.1.2"; + version = "0.2.2"; src = fetchFromGitHub { owner = "timbertson"; repo = "nix-pin"; - rev = "version-0.1.2"; - sha256 = "1zwfb5198qzbjwivgiaxbwva9frgrrqaj92nw8vz95yi08pijssh"; + rev = "version-0.2.2"; + sha256 = "1kw43kzy4m6lnnif51r2a8i4vcgr7d4vqb1c75p7pk2b9y3jwxsz"; }; buildInputs = [ python3 mypy ]; buildPhase = '' @@ -16,12 +16,27 @@ let self = stdenv.mkDerivation rec { mkdir "$out" cp -r bin share "$out" ''; - passthru = { - callWithPins = path: args: - import "${self}/share/nix/call.nix" { - inherit pkgs path args; - }; - }; + passthru = + let + defaults = import "${self}/share/nix/defaults.nix"; + in { + api = { pinConfig ? defaults.pinConfig }: + let impl = import "${self}/share/nix/api.nix" { inherit pkgs pinConfig; }; in + { inherit (impl) augmentedPkgs pins callPackage; }; + updateScript = '' + set -e + echo + cd ${toString ./.} + ${pkgs.nix-update-source}/bin/nix-update-source \ + --prompt version \ + --replace-attr version \ + --set owner timbertson \ + --set repo nix-pin \ + --set type fetchFromGitHub \ + --set rev 'version-{version}' \ + --modify-nix default.nix + ''; + }; meta = with stdenv.lib; { homepage = "https://github.com/timbertson/nix-pin"; description = "nixpkgs development utility";