2021-04-18 03:13:58 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromSourcehut
|
|
|
|
, buildPythonPackage
|
2019-01-22 02:01:52 +00:00
|
|
|
, buildGoModule
|
2021-04-18 03:13:58 +00:00
|
|
|
, python
|
|
|
|
, srht
|
|
|
|
, pygit2
|
|
|
|
, scmsrht
|
2021-08-27 09:42:25 +00:00
|
|
|
, srht-keys
|
2021-04-18 03:13:58 +00:00
|
|
|
}:
|
2019-01-22 02:01:52 +00:00
|
|
|
let
|
2021-11-13 21:46:58 +00:00
|
|
|
version = "0.73.6";
|
2021-04-18 03:13:58 +00:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~sircmpwn";
|
|
|
|
repo = "git.sr.ht";
|
|
|
|
rev = version;
|
2021-11-13 21:46:58 +00:00
|
|
|
sha256 = "sha256-9WdeHXmyX5K/ldaE9AbSWTRlsrSDuKtm8QhthEHfmuU=";
|
2021-04-18 03:13:58 +00:00
|
|
|
};
|
2019-01-22 02:01:52 +00:00
|
|
|
|
2021-08-27 09:42:25 +00:00
|
|
|
gitsrht-shell = buildGoModule {
|
2019-11-04 02:20:02 +00:00
|
|
|
inherit src version;
|
2021-08-27 09:42:25 +00:00
|
|
|
sourceRoot = "source/gitsrht-shell";
|
2019-12-30 01:03:37 +00:00
|
|
|
pname = "gitsrht-shell";
|
2021-04-18 03:13:58 +00:00
|
|
|
vendorSha256 = "sha256-aqUFICp0C2reqb2p6JCPAUIRsxzSv0t9BHoNWrTYfqk=";
|
2019-11-04 02:20:02 +00:00
|
|
|
};
|
|
|
|
|
2021-08-27 09:42:25 +00:00
|
|
|
gitsrht-dispatch = buildGoModule {
|
2019-01-22 02:01:52 +00:00
|
|
|
inherit src version;
|
2021-08-27 09:42:25 +00:00
|
|
|
sourceRoot = "source/gitsrht-dispatch";
|
|
|
|
pname = "gitsrht-dispatch";
|
2021-04-18 03:13:58 +00:00
|
|
|
vendorSha256 = "sha256-qWXPHo86s6iuRBhRMtmD5jxnAWKdrWHtA/iSUkdw89M=";
|
2021-08-27 09:42:25 +00:00
|
|
|
patches = [
|
|
|
|
# Add support for supplementary groups
|
|
|
|
patches/redis-socket/git/v3-0003-gitsrht-dispatch-add-support-for-supplementary-gr.patch
|
|
|
|
];
|
|
|
|
patchFlags = ["-p2"];
|
2019-01-22 02:01:52 +00:00
|
|
|
};
|
2019-12-30 01:03:37 +00:00
|
|
|
|
2021-08-27 09:42:25 +00:00
|
|
|
gitsrht-keys = buildGoModule {
|
2019-12-30 01:03:37 +00:00
|
|
|
inherit src version;
|
2021-08-27 09:42:25 +00:00
|
|
|
sourceRoot = "source/gitsrht-keys";
|
2019-12-30 01:03:37 +00:00
|
|
|
pname = "gitsrht-keys";
|
2021-10-23 00:19:38 +00:00
|
|
|
vendorSha256 = "sha256-SOI7wimFthY+BwsDtMuyqKS1hCaEa3R90Q0qaA9boyE=";
|
2021-08-27 09:42:25 +00:00
|
|
|
|
|
|
|
# What follows is only to update go-redis,
|
|
|
|
# and thus also using a patched srht-keys.
|
|
|
|
# go.{mod,sum} could be patched directly but that would be less resilient
|
|
|
|
# to changes from upstream, and thus harder to maintain the patching
|
|
|
|
# while it hasn't been merged upstream.
|
|
|
|
|
|
|
|
overrideModAttrs = _: {
|
|
|
|
preBuild = ''
|
|
|
|
# This is a fixed-output derivation so it is not allowed to reference other derivations,
|
|
|
|
# but here srht-keys will be copied to vendor/ by go mod vendor
|
|
|
|
ln -s ${srht-keys} srht-keys
|
|
|
|
go mod edit -replace git.sr.ht/~sircmpwn/scm.sr.ht/srht-keys=$PWD/srht-keys
|
|
|
|
go get github.com/go-redis/redis/v8
|
|
|
|
go get github.com/go-redis/redis@none
|
|
|
|
go mod tidy
|
|
|
|
'';
|
|
|
|
# Pass updated go.{mod,sum} from go-modules to gitsrht-keys' vendor/go.{mod,sum}
|
|
|
|
postInstall = ''
|
|
|
|
cp --reflink=auto go.* $out/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Update go-redis to support Unix sockets
|
|
|
|
patches/redis-socket/git/v3-0001-gitsrht-keys-update-go-redis-to-support-Unix-sock.patch
|
|
|
|
];
|
|
|
|
patchFlags = ["-p2"];
|
|
|
|
postConfigure = ''
|
|
|
|
cp -v vendor/go.{mod,sum} .
|
|
|
|
'';
|
2019-12-30 01:03:37 +00:00
|
|
|
};
|
|
|
|
|
2021-08-27 09:42:25 +00:00
|
|
|
gitsrht-update-hook = buildGoModule {
|
2019-12-30 01:03:37 +00:00
|
|
|
inherit src version;
|
2021-08-27 09:42:25 +00:00
|
|
|
sourceRoot = "source/gitsrht-update-hook";
|
2019-12-30 01:03:37 +00:00
|
|
|
pname = "gitsrht-update-hook";
|
2021-11-13 21:46:58 +00:00
|
|
|
vendorSha256 = "sha256-L/tGwbBSwhtGhHcinCK/0lsp1ffXjiHXCmGgsY9s2Nc=";
|
2020-06-23 00:18:41 +00:00
|
|
|
|
2021-08-27 09:42:25 +00:00
|
|
|
# What follows is only to update go-redis
|
|
|
|
# and thus also using a patched srht-keys.
|
|
|
|
|
|
|
|
overrideModAttrs = old: {
|
|
|
|
preBuild = ''
|
|
|
|
# This is a fixed-output derivation so it is not allowed to reference other derivations,
|
|
|
|
# but here srht-keys will be copied to vendor/ by go mod vendor
|
|
|
|
ln -s ${srht-keys} srht-keys
|
|
|
|
go mod edit -replace git.sr.ht/~sircmpwn/scm.sr.ht/srht-keys=$PWD/srht-keys
|
|
|
|
go get github.com/go-redis/redis/v8
|
|
|
|
go get github.com/go-redis/redis@none
|
|
|
|
go mod tidy
|
|
|
|
'';
|
|
|
|
# Pass updated go.{mod,sum} from go-modules to gitsrht-keys' vendor/go.{mod,sum}
|
|
|
|
postInstall = ''
|
|
|
|
cp --reflink=auto go.* $out/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Update go-redis to support Unix sockets
|
|
|
|
patches/redis-socket/git/v3-0002-gitsrht-update-hook-update-go-redis-to-support-Un.patch
|
|
|
|
];
|
|
|
|
patchFlags = ["-p2"];
|
|
|
|
postConfigure = ''
|
|
|
|
cp -v vendor/go.{mod,sum} .
|
|
|
|
'';
|
|
|
|
};
|
2019-01-22 02:01:52 +00:00
|
|
|
|
2021-04-18 03:13:58 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
inherit src version;
|
|
|
|
pname = "gitsrht";
|
2019-01-22 02:01:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = srht.nativeBuildInputs;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
srht
|
|
|
|
pygit2
|
|
|
|
scmsrht
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export PKGVER=${version}
|
2021-04-18 03:13:58 +00:00
|
|
|
export SRHT_PATH=${srht}/${python.sitePackages}/srht
|
2019-01-22 02:01:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/bin
|
2021-08-27 09:42:25 +00:00
|
|
|
cp ${gitsrht-shell}/bin/gitsrht-shell $out/bin/gitsrht-shell
|
|
|
|
cp ${gitsrht-dispatch}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch
|
|
|
|
cp ${gitsrht-keys}/bin/gitsrht-keys $out/bin/gitsrht-keys
|
|
|
|
cp ${gitsrht-update-hook}/bin/gitsrht-update-hook $out/bin/gitsrht-update-hook
|
2019-01-22 02:01:52 +00:00
|
|
|
'';
|
2021-04-18 03:13:58 +00:00
|
|
|
passthru = {
|
2021-08-27 09:42:25 +00:00
|
|
|
inherit gitsrht-shell gitsrht-dispatch gitsrht-keys gitsrht-update-hook;
|
2021-04-18 03:13:58 +00:00
|
|
|
};
|
2021-01-03 05:36:55 +00:00
|
|
|
|
2021-08-15 21:11:47 +00:00
|
|
|
pythonImportsCheck = [ "gitsrht" ];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://git.sr.ht/~sircmpwn/git.sr.ht";
|
2019-01-22 02:01:52 +00:00
|
|
|
description = "Git repository hosting service for the sr.ht network";
|
2021-08-15 20:54:11 +00:00
|
|
|
license = licenses.agpl3Only;
|
2019-01-22 02:01:52 +00:00
|
|
|
maintainers = with maintainers; [ eadwu ];
|
|
|
|
};
|
2020-07-31 03:58:04 +00:00
|
|
|
}
|