2019-02-26 11:45:54 +00:00
|
|
|
{ lib, pkgs, stdenv, fetchFromGitHub, mypy, python3, nix, git, makeWrapper
|
|
|
|
, runtimeShell }:
|
2018-03-20 10:37:09 +00:00
|
|
|
let self = stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "nix-pin";
|
2018-09-18 11:48:21 +01:00
|
|
|
version = "0.4.0";
|
2018-03-20 10:37:09 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "timbertson";
|
|
|
|
repo = "nix-pin";
|
2018-09-18 11:48:21 +01:00
|
|
|
rev = "version-${version}";
|
|
|
|
sha256 = "1pccvc0iqapms7kidrh09g5fdx44x622r5l9k7bkmssp3v4c68vy";
|
2018-03-20 10:37:09 +00:00
|
|
|
};
|
2018-05-05 10:53:40 +01:00
|
|
|
buildInputs = [ python3 mypy makeWrapper ];
|
2018-05-09 12:14:44 +01:00
|
|
|
checkPhase = ''
|
2018-03-20 10:37:09 +00:00
|
|
|
mypy bin/*
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
mkdir "$out"
|
|
|
|
cp -r bin share "$out"
|
2018-05-05 10:53:40 +01:00
|
|
|
wrapProgram $out/bin/nix-pin \
|
|
|
|
--prefix PATH : "${lib.makeBinPath [ nix git ]}"
|
2018-03-20 10:37:09 +00:00
|
|
|
'';
|
2018-04-22 01:28:11 +01:00
|
|
|
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 = ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2018-04-22 01:28:11 +01:00
|
|
|
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}' \
|
2018-09-18 11:48:21 +01:00
|
|
|
--substitute rev 'version-''${{version}}' \
|
2018-04-22 01:28:11 +01:00
|
|
|
--modify-nix default.nix
|
|
|
|
'';
|
|
|
|
};
|
2018-03-20 10:37:09 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "https://github.com/timbertson/nix-pin";
|
|
|
|
description = "nixpkgs development utility";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.timbertson ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}; in self
|