2020-12-07 07:45:13 +00:00
|
|
|
{ lib, pkgs, fetchFromGitHub, python3Packages, nix-prefetch-scripts, runtimeShell }:
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2020-12-07 07:45:13 +00:00
|
|
|
pname = "nix-update-source";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.7.0";
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-+49Yb+rZ3CzFnwEpwj5xrcMUVBiYOJtCk9YeZ15IM/U=";
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "timbertson";
|
|
|
|
repo = "nix-update-source";
|
2020-12-07 07:45:13 +00:00
|
|
|
rev = "version-${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [ nix-prefetch-scripts ];
|
2020-12-07 07:45:13 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
json // json.fetch // {
|
|
|
|
inherit src;
|
|
|
|
overrideSrc = drv: lib.overrideDerivation drv (orig: { inherit src; });
|
|
|
|
};
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
updateScript = [
|
|
|
|
runtimeShell
|
|
|
|
"-c"
|
|
|
|
''
|
|
|
|
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}' \
|
|
|
|
--nix-literal rev 'version-''${version}'\
|
|
|
|
--modify-nix default.nix
|
|
|
|
''
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2024-04-21 15:54:59 +00:00
|
|
|
homepage = "https://github.com/timbertson/nix-update-source";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utility to automate updating of nix derivation sources";
|
|
|
|
maintainers = with lib.maintainers; [ timbertson ];
|
|
|
|
license = lib.licenses.mit;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "nix-update-source";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|