2019-06-16 20:59:06 +01:00
|
|
|
{ lib, pkgs, fetchFromGitHub, python3Packages, nix-prefetch-scripts
|
2019-02-26 11:45:54 +00:00
|
|
|
, runtimeShell }:
|
2017-02-11 11:37:53 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2018-06-18 13:09:52 +01:00
|
|
|
version = "0.6.3";
|
2017-02-11 11:37:53 +00:00
|
|
|
name = "nix-update-source-${version}";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "timbertson";
|
|
|
|
repo = "nix-update-source";
|
2018-06-18 13:09:52 +01:00
|
|
|
rev = "version-0.6.3";
|
|
|
|
sha256 = "157wvv9vnaszzwbj68jpdc0imcm1hdab3z760bx2axbsgfpqqilz";
|
2017-02-11 11:37:53 +00:00
|
|
|
};
|
|
|
|
propagatedBuildInputs = [ nix-prefetch-scripts ];
|
|
|
|
passthru = {
|
|
|
|
# NOTE: `fetch` should not be used within nixpkgs because it
|
|
|
|
# uses a non-idiomatic structure. It is provided for use by
|
|
|
|
# out-of-tree nix derivations.
|
|
|
|
fetch = path:
|
|
|
|
let
|
|
|
|
fetchers = {
|
|
|
|
# whitelist of allowed fetchers
|
|
|
|
inherit (pkgs) fetchgit fetchurl fetchFromGitHub;
|
|
|
|
};
|
|
|
|
json = lib.importJSON path;
|
|
|
|
fetchFn = builtins.getAttr json.fetch.fn fetchers;
|
|
|
|
src = fetchFn json.fetch.args;
|
|
|
|
in
|
2018-04-22 02:32:11 +01:00
|
|
|
json // json.fetch // {
|
|
|
|
inherit src;
|
|
|
|
overrideSrc = drv: lib.overrideDerivation drv (orig: { inherit src; });
|
|
|
|
};
|
2017-02-11 11:37:53 +00:00
|
|
|
updateScript = ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2017-02-11 11:37:53 +00: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-update-source \
|
|
|
|
--set type fetchFromGitHub \
|
|
|
|
--set rev 'version-{version}' \
|
|
|
|
--modify-nix default.nix
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
meta = {
|
|
|
|
description = "Utility to automate updating of nix derivation sources";
|
|
|
|
maintainers = with lib.maintainers; [ timbertson ];
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
};
|
|
|
|
}
|