depot/third_party/nixpkgs/pkgs/applications/version-management/sourcehut/paste.nix
Default email c7cb07f092 Project import generated by Copybara.
GitOrigin-RevId: 1536926ef5621b09bba54035ae2bb6d806d72ac8
2024-02-29 21:09:43 +01:00

72 lines
1.4 KiB
Nix

{ lib
, fetchFromSourcehut
, buildGoModule
, buildPythonPackage
, srht
, pip
, pyyaml
, python
, pythonOlder
, setuptools
, unzip
}:
let
version = "0.15.2";
gqlgen = import ./fix-gqlgen-trimpath.nix { inherit unzip; gqlgenVersion = "0.17.20"; };
src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "paste.sr.ht";
rev = version;
hash = "sha256-ZZzcd14Jbo1MfET7B56X/fl9xWXpCJ8TuKrGVgJwZfQ=";
};
pastesrht-api = buildGoModule ({
inherit src version;
pname = "pastesrht-api";
modRoot = "api";
vendorHash = "sha256-jiE73PUPSHxtWp7XBdH4mJw95pXmZjCl4tk2wQUf2M4=";
} // gqlgen);
in
buildPythonPackage rec {
inherit src version;
pname = "pastesrht";
pyproject = true;
disabled = pythonOlder "3.7";
postPatch = ''
substituteInPlace Makefile \
--replace "all: api" ""
'';
nativeBuildInputs = [
pip
setuptools
];
propagatedBuildInputs = [
srht
pyyaml
];
preBuild = ''
export PKGVER=${version}
export SRHT_PATH=${srht}/${python.sitePackages}/srht
'';
postInstall = ''
mkdir -p $out/bin
ln -s ${pastesrht-api}/bin/api $out/bin/pastesrht-api
'';
pythonImportsCheck = [ "pastesrht" ];
meta = with lib; {
homepage = "https://git.sr.ht/~sircmpwn/paste.sr.ht";
description = "Ad-hoc text file hosting service for the sr.ht network";
license = licenses.agpl3Only;
maintainers = with maintainers; [ eadwu nessdoor christoph-heiss ];
};
}