Skip to content

Commit

Permalink
fetchgitiles: add tag argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Bot-wxt1221 committed Dec 24, 2024
1 parent 4616db6 commit e64344c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pkgs/build-support/fetchgitiles/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,36 @@
lib.makeOverridable (
{
url,
rev,
rev ? null,
tag ? null,
name ? "source",
...
}@args:

assert (
lib.assertMsg (lib.xor (tag == null) (
rev == null
)) "fetchFromGitiles requires one of either `rev` or `tag` to be provided (not both)."
);

let
realrev = (if tag != null then "refs/tags/" + tag else rev);
in

fetchzip (
{
inherit name;
url = "${url}/+archive/${rev}.tar.gz";
url = "${url}/+archive/${realrev}.tar.gz";
stripRoot = false;
meta.homepage = url;
}
// removeAttrs args [
"url"
"tag"
"rev"
]
)
// {
inherit rev;
inherit rev tag;
}
)

0 comments on commit e64344c

Please sign in to comment.