···
1
+
{ lib, buildGoModule, buildNpmPackage, fetchFromGitHub, moreutils, jq, git }:
3
+
# finalAttrs when 🥺 (buildGoModule does not support them)
4
+
# https://github.com/NixOS/nixpkgs/issues/273815
6
+
src = fetchFromGitHub {
10
+
hash = "sha256-rJ8oiH08kSSFNgPHKGo68Oi1i3L1SEJyHuzoxKMOZME=";
13
+
frontend = buildNpmPackage {
14
+
pname = "opengist-frontend";
15
+
inherit version src;
17
+
nativeBuildInputs = [ moreutils jq ];
19
+
# npm complains of "invalid package". shrug. we can give it a version.
21
+
jq '.version = "${version}"' package.json | sponge package.json
24
+
# copy pasta from the Makefile upstream, seems to be a workaround of sass
25
+
# issues, unsure why it is not done in vite:
26
+
# https://github.com/thomiceli/opengist/blob/05eccfa8e728335514a40476cd8116cfd1ca61dd/Makefile#L16-L19
28
+
EMBED=1 npx postcss 'public/assets/embed-*.css' -c public/postcss.config.js --replace
36
+
npmDepsHash = "sha256-Sy321tIQOOrypk+EOGGixEzrPdhA9U8Hak+DOS+d00A=";
41
+
inherit version src;
42
+
vendorHash = "sha256-IorqXJKzUTUL5zfKRipZaJtRlwVOmTwolJXFG/34Ais=";
47
+
# required for tests
48
+
nativeCheckInputs = [
52
+
# required for tests to not try to write into $HOME and fail
54
+
export OG_OPENGIST_HOME=$(mktemp -d)
58
+
cp -R ${frontend}/public/{manifest.json,assets} public/
61
+
passthru.frontend = frontend;
64
+
description = "Self-hosted pastebin powered by Git";
65
+
homepage = "https://github.com/thomiceli/opengist";
66
+
license = lib.licenses.agpl3Only;
67
+
maintainers = with lib.maintainers; [ lf- ];
68
+
platforms = lib.platforms.unix;