diff options
author | Tomas Antonio Lopez <entropy.overseer@entropic.network> | 2023-08-26 15:13:52 +0200 |
---|---|---|
committer | Tomas Antonio Lopez <entropy.overseer@entropic.network> | 2023-11-14 11:12:14 +0100 |
commit | 5476b490d4c47655ee6345a120b663fa5351ee07 (patch) | |
tree | 9a3de074b9d32ee0bad8fac16ea59dbc234c981d | |
parent | 3881f6f864fcd788efc7402bd8149ac5d07e6882 (diff) |
nixos/sourcehut: compile and integrate paste.sr.ht API component
-rw-r--r-- | nixos/modules/services/misc/sourcehut/default.nix | 5 | ||||
-rw-r--r-- | pkgs/applications/version-management/sourcehut/paste.nix | 21 |
2 files changed, 24 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/sourcehut/default.nix b/nixos/modules/services/misc/sourcehut/default.nix index f2b09f4bc4b61..8719a176973c6 100644 --- a/nixos/modules/services/misc/sourcehut/default.nix +++ b/nixos/modules/services/misc/sourcehut/default.nix @@ -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" { diff --git a/pkgs/applications/version-management/sourcehut/paste.nix b/pkgs/applications/version-management/sourcehut/paste.nix index faa8e26f5ef8b..689ae0dad132f 100644 --- a/pkgs/applications/version-management/sourcehut/paste.nix +++ b/pkgs/applications/version-management/sourcehut/paste.nix @@ -1,13 +1,14 @@ { lib , fetchFromSourcehut +, buildGoModule , buildPythonPackage , srht , pyyaml , python +, unzip }: -buildPythonPackage rec { - pname = "pastesrht"; +let version = "0.15.1"; src = fetchFromSourcehut { @@ -17,6 +18,17 @@ buildPythonPackage rec { sha256 = "sha256-IUFX7/V8AWqN+iuisLAyu7lMNIUCzSMoOfcZiYJTnrM="; }; + pastesrht-api = buildGoModule ({ + inherit src version; + pname = "pastesrht-api"; + modRoot = "api"; + vendorSha256 = "sha256-jiE73PUPSHxtWp7XBdH4mJw95pXmZjCl4tk2wQUf2M4"; + } // import ./fix-gqlgen-trimpath.nix { inherit unzip; }); +in +buildPythonPackage rec { + inherit src version; + pname = "pastesrht"; + postPatch = '' substituteInPlace Makefile \ --replace "all: api" "" @@ -32,6 +44,11 @@ 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; { |