Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
92 lines
2.2 KiB
Nix
92 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildGoModule,
|
|
buildNpmPackage,
|
|
fetchFromGitHub,
|
|
moreutils,
|
|
jq,
|
|
git,
|
|
writableTmpDirAsHomeHook,
|
|
}:
|
|
|
|
buildGoModule (finalAttrs: {
|
|
pname = "opengist";
|
|
|
|
version = "1.11.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "thomiceli";
|
|
repo = "opengist";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-TlUaen8uCj4Ba2gOWG32Gk4KIDvitXai5qv4PTeizYo=";
|
|
};
|
|
|
|
frontend = buildNpmPackage {
|
|
pname = "opengist-frontend";
|
|
inherit (finalAttrs) version src;
|
|
|
|
# npm complains of "invalid package". shrug. we can give it a version.
|
|
postPatch = ''
|
|
${lib.getExe jq} '.version = "${finalAttrs.version}"' package.json | ${lib.getExe' moreutils "sponge"} package.json
|
|
'';
|
|
|
|
# copy pasta from the Makefile upstream, seems to be a workaround of sass
|
|
# issues, unsure why it is not done in vite:
|
|
# https://github.com/thomiceli/opengist/blob/05eccfa8e728335514a40476cd8116cfd1ca61dd/Makefile#L16-L19
|
|
postBuild = ''
|
|
EMBED=1 npx postcss 'public/assets/embed-*.css' -c public/postcss.config.js --replace
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -R public $out
|
|
'';
|
|
|
|
npmDepsHash = "sha256-zBao/EoAolkgMvqQPqN0P2VC4tT6gkQPqIk4HyfXC7o=";
|
|
};
|
|
|
|
vendorHash = "sha256-NGRJuNSypmIc8G0wMW7HT+LkP5i5n/p3QH8FyU9pF5w=";
|
|
|
|
tags = [ "fs_embed" ];
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-X github.com/thomiceli/opengist/internal/config.OpengistVersion=v${finalAttrs.version}"
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
git
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
|
|
make test
|
|
|
|
runHook postCheck
|
|
'';
|
|
|
|
postPatch = ''
|
|
cp -R ${finalAttrs.frontend}/public/{manifest.json,assets} public/
|
|
'';
|
|
|
|
passthru = {
|
|
inherit (finalAttrs) frontend;
|
|
updateScript = ./update.sh;
|
|
};
|
|
|
|
meta = {
|
|
description = "Self-hosted pastebin powered by Git";
|
|
homepage = "https://github.com/thomiceli/opengist";
|
|
license = lib.licenses.agpl3Only;
|
|
changelog = "https://github.com/thomiceli/opengist/blob/v${finalAttrs.version}/CHANGELOG.md";
|
|
platforms = lib.platforms.unix;
|
|
maintainers = with lib.maintainers; [ phanirithvij ];
|
|
mainProgram = "opengist";
|
|
};
|
|
})
|