Skip to content

Commit

Permalink
Merge pull request #22660 from timbertson/nix-update-source
Browse files Browse the repository at this point in the history
nix-update-source: init at 0.3.0
  • Loading branch information
7c6f434c authored Apr 30, 2017
2 parents 67c309d + 892fd83 commit ebc9e7a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions pkgs/tools/package-management/nix-update-source/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ lib, pkgs, fetchFromGitHub, python3Packages, nix-prefetch-scripts }:
python3Packages.buildPythonApplication rec {
version = "0.4.0";
name = "nix-update-source-${version}";
src = fetchFromGitHub {
owner = "timbertson";
repo = "nix-update-source";
rev = "version-0.4.0";
sha256 = "0gz0f7nx1q697s16ya7q84q1cj020n547k2ffb99ds2r40nckr2g";
};
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
json // json.fetch // { inherit src; };
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-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;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18117,6 +18117,8 @@ with pkgs;
nix-prefetch-svn
nix-prefetch-scripts;

nix-update-source = callPackage ../tools/package-management/nix-update-source {};

nix-template-rpm = callPackage ../build-support/templaterpm { inherit (pythonPackages) python toposort; };

nix-repl = callPackage ../tools/package-management/nix-repl { };
Expand Down

0 comments on commit ebc9e7a

Please sign in to comment.