mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
fetchFromSourcehut: init
This commit is contained in:
parent
8aca4a8fa7
commit
83a0627f33
@ -68,3 +68,7 @@ This is used with Savannah repositories. The arguments expected are very similar
|
||||
## `fetchFromRepoOrCz`
|
||||
|
||||
This is used with repo.or.cz repositories. The arguments expected are very similar to fetchFromGitHub above.
|
||||
|
||||
## `fetchFromSourcehut`
|
||||
|
||||
This is used with sourcehut repositories. The arguments expected are very similar to fetchFromGitHub above. Don't forget the tilde (~) in front of the user name!
|
||||
|
25
pkgs/build-support/fetchsourcehut/default.nix
Normal file
25
pkgs/build-support/fetchsourcehut/default.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ fetchzip, lib }:
|
||||
|
||||
{ owner
|
||||
, repo, rev
|
||||
, domain ? "sr.ht"
|
||||
, vc ? "git"
|
||||
, name ? "source"
|
||||
, ... # For hash agility
|
||||
} @ args:
|
||||
|
||||
with lib;
|
||||
|
||||
assert (lib.assertOneOf "vc" vc [ "hg" "git" ]);
|
||||
|
||||
let
|
||||
baseUrl = "https://${vc}.${domain}/${owner}/${repo}";
|
||||
|
||||
in fetchzip (recursiveUpdate {
|
||||
inherit name;
|
||||
url = "${baseUrl}/archive/${rev}.tar.gz";
|
||||
meta.homepage = "${baseUrl}/";
|
||||
extraPostFetch = optionalString (vc == "hg") ''
|
||||
rm -f "$out/.hg_archival.txt"
|
||||
''; # impure file; see #12002
|
||||
} (removeAttrs args [ "owner" "repo" "rev" "domain" "vc" ])) // { inherit rev; }
|
@ -475,6 +475,8 @@ in
|
||||
|
||||
fetchFromSavannah = callPackage ../build-support/fetchsavannah {};
|
||||
|
||||
fetchFromSourcehut = callPackage ../build-support/fetchsourcehut { };
|
||||
|
||||
fetchFromGitLab = callPackage ../build-support/fetchgitlab {};
|
||||
|
||||
fetchFromGitiles = callPackage ../build-support/fetchgitiles {};
|
||||
|
Loading…
Reference in New Issue
Block a user