Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nixos/modules/services/misc/sourcehut/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,11 @@ in
(import ./service.nix "paste" {
inherit configIniOfService;
port = 5011;
extraServices.pastesrht-api = {
serviceConfig.Restart = "always";
serviceConfig.RestartSec = "5s";
serviceConfig.ExecStart = "${pkgs.sourcehut.pastesrht}/bin/pastesrht-api -b ${cfg.listenAddress}:${toString (cfg.paste.port + 100)}";
};
})

(import ./service.nix "todo" {
Expand Down
27 changes: 22 additions & 5 deletions pkgs/applications/version-management/sourcehut/paste.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
{ lib
, fetchFromSourcehut
, buildGoModule
, buildPythonPackage
, srht
, pyyaml
, python
, unzip
}:

buildPythonPackage rec {
pname = "pastesrht";
version = "0.15.1";
let
version = "0.15.2";

src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "paste.sr.ht";
rev = version;
sha256 = "sha256-IUFX7/V8AWqN+iuisLAyu7lMNIUCzSMoOfcZiYJTnrM=";
sha256 = "sha256-ZZzcd14Jbo1MfET7B56X/fl9xWXpCJ8TuKrGVgJwZfQ=";
};

pastesrht-api = buildGoModule ({
inherit src version;
pname = "pastesrht-api";
modRoot = "api";
vendorHash = "sha256-jiE73PUPSHxtWp7XBdH4mJw95pXmZjCl4tk2wQUf2M4=";
} // import ./fix-gqlgen-trimpath.nix { inherit unzip; });
in
buildPythonPackage rec {
inherit src version;
pname = "pastesrht";

postPatch = ''
substituteInPlace Makefile \
--replace "all: api" ""
Expand All @@ -32,12 +44,17 @@ buildPythonPackage rec {
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 ];
maintainers = with maintainers; [ eadwu nessdoor ];
};
}