summary refs log tree commit diff
path: root/pkgs/tools/package-management/nix-update-source/default.nix
blob: 06ac8203f82218e1e6697be7f708e1b0c999f7cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ lib, pkgs, fetchFromGitHub, python3Packages, nix-prefetch-scripts }:
python3Packages.buildPythonApplication rec {
  version = "0.2.1";
  name = "nix-update-source-${version}";
  src = fetchFromGitHub {
    owner = "timbertson";
    repo = "nix-update-source";
    rev = "version-${version}";
    sha256 = "1w3aj0kjp8zhxkzqxnm5srrsqsvrmxhn4sqkr4kjffh61jg8jq8a";
  };
  propagatedBuildInputs = [ nix-prefetch-scripts ];
  passthru = {
    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 // { inherit src; };
  };
  meta = {
    description = "Utility to autimate updating of nix derivation sources";
    maintainers = with lib.maintainers; [ timbertson ];
  };
}