Merge pull request #102225 from luc65r/fetchsrht

Add fetcher: fetchFromSourcehut
This commit is contained in:
Michael Weiss 2021-03-11 12:51:13 +01:00 committed by GitHub
commit 938453eacd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 15 deletions

View file

@ -72,3 +72,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!

View file

@ -1,5 +1,5 @@
{ lib
, fetchurl
, fetchFromSourcehut
, rustPlatform
, pkg-config
, wrapGAppsHook
@ -15,9 +15,11 @@ rustPlatform.buildRustPackage rec {
pname = "castor";
version = "0.8.16";
src = fetchurl {
url = "https://git.sr.ht/~julienxx/castor/archive/${version}.tar.gz";
sha256 = "1qwsprwazkzcs70h219fhh5jj5s5hm1k120fn3pk4qivii4lyhah";
src = fetchFromSourcehut {
owner = "~julienxx";
repo = pname;
rev = version;
sha256 = "0rwg1w7srjwa23mkypl8zk6674nhph4xsc6nc01f6g5k959szylr";
};
cargoSha256 = "0yn2kfiaz6d8wc8rdqli2pwffp5vb1v3zi7520ysrd5b6fc2csf2";

View 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; }

View file

@ -1,12 +1,14 @@
{ lib, stdenv, fetchhg, meson, ninja, pkg-config, wlroots, wayland, wayland-protocols
{ lib, stdenv, fetchFromSourcehut, meson, ninja, pkg-config, wlroots, wayland, wayland-protocols
, libX11, libGL }:
stdenv.mkDerivation {
name = "glpaper";
stdenv.mkDerivation rec {
pname = "glpaper";
version = "unstable-2020-10-11";
src = fetchhg {
url = "https://hg.sr.ht/~scoopta/glpaper";
src = fetchFromSourcehut {
owner = "~scoopta";
repo = pname;
vc = "hg";
rev = "9e7ec7cd270af330039c395345c7d23c04682267";
sha256 = "sha256-yBHRg6eg+PK/ixuM0MBty3RJY9qcemr3Dt+8SAitqnk=";
};

View file

@ -1,11 +1,12 @@
{ lib, stdenv, fetchgit, port ? "1234" }:
{ lib, stdenv, fetchFromSourcehut, port ? "1234" }:
stdenv.mkDerivation {
pname = "among-sus-unstable";
version = "2020-10-29";
src = fetchgit {
url = "https://git.sr.ht/~martijnbraam/among-sus";
src = fetchFromSourcehut {
owner = "~martijnbraam";
repo = "among-sus";
rev = "1f4c8d800d025d36ac66826937161be3252fbc57";
sha256 = "19jq7ygh9l11dl1h6702bg57m04y35nqd6yqx1rgp1kxwhp45xyh";
};

View file

@ -1,11 +1,12 @@
{ lib, fetchgit, rustPlatform, pkg-config, openssl }:
{ lib, fetchFromSourcehut, rustPlatform, pkg-config, openssl }:
rustPlatform.buildRustPackage rec {
pname = "eidolon";
version = "1.4.6";
src = fetchgit {
url = "https://git.sr.ht/~nicohman/eidolon";
src = fetchFromSourcehut {
owner = "~nicohman";
repo = pname;
rev = version;
sha256 = "1yn3k569pxzw43mmsk97088xpkdc714rks3ncchbb6ccx25kgxrr";
};

View file

@ -482,6 +482,8 @@ in
fetchFromSavannah = callPackage ../build-support/fetchsavannah {};
fetchFromSourcehut = callPackage ../build-support/fetchsourcehut { };
fetchFromGitLab = callPackage ../build-support/fetchgitlab {};
fetchFromGitiles = callPackage ../build-support/fetchgitiles {};