commit c80941752762e593649fdb132cda4ecb0e95ef93
parent 36f58b6595814807e059edc3295938b4ffb97e0c
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 21 Aug 2025 15:42:55 +0200
parent 36f58b6595814807e059edc3295938b4ffb97e0c
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 21 Aug 2025 15:42:55 +0200
packages: add `gotosocial-unstable`
1 file changed, 129 insertions(+), 0 deletions(-)
A
|
129
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/packages/gotosocial-unstable/package.nix b/packages/gotosocial-unstable/package.nix @@ -0,0 +1,129 @@ +{ + tgcMaintainers, + unstable, + lib, + fetchFromGitea, + applyPatches, + mkYarnPackage, + makeWrapper, + installShellFiles, + nixosTests, + ... +}: + +unstable.buildGo125Module (finalAttrs: { + pname = "gotosocial"; + version = "0.20.0-unstable-2025-08-20-${builtins.substring 0 6 finalAttrs.rev}"; + rev = "6faa8e9a9062f3e4d9e82329911cfecef8f6fc04"; + srcHash = "sha256-GXX5Mm4V2dZCCVhqFxElDeCZE+UsWBdMsuv5zMezH70="; + + src = applyPatches { + src = fetchFromGitea { + domain = "codeberg.org"; + owner = "superseriousbusiness"; + repo = "gotosocial"; + hash = finalAttrs.srcHash; + inherit (finalAttrs) rev; + }; + patches = [ ]; + }; + + frontend-assets = mkYarnPackage { + name = "${finalAttrs.pname}-${finalAttrs.version}-frontendAssets"; + inherit (finalAttrs) src version; + + packageJSON = "${finalAttrs.src}/web/source/package.json"; + yarnLock = "${finalAttrs.src}/web/source/yarn.lock"; + + configurePhase = '' + cp -r $node_modules node_modules + chmod +w -R node_modules + ''; + + buildPhase = '' + mkdir -p ./web/source ./web/assets + + cp -r $src/web/source/. ./web/source + cp -r $src/web/assets/. ./web/assets + + export NODE_OPTIONS=--openssl-legacy-provider + node ./node_modules/ts-patch/bin/ts-patch.js install + yarn --offline --cwd ./web/source build + ''; + + distPhase = "true"; + installPhase = "cp -r ./web/assets $out"; + + meta.license = lib.licenses.agpl3Only; + }; + + ldflags = [ + "-s" + "-w" + "-X 'main.Commit=${finalAttrs.rev}'" + "-X 'main.Version=${finalAttrs.version}'" + ]; + tags = [ + "netgo" + "osusergo" + "static_build" + "kvformat" + ]; + + vendorHash = null; + + nativeBuildInputs = [ installShellFiles ]; + buildInputs = [ makeWrapper ]; + + # tests are working only on x86_64-linux + # doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64; + # checks are currently very unstable in our setup, so we should test manually for now + doCheck = false; + + checkFlags = + let + # flaky / broken tests + skippedTests = [ + # See: https://github.com/superseriousbusiness/gotosocial/issues/2651 + "TestPage/minID,_maxID_and_limit_set" + ]; + in + [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]; + + installCheckPhase = '' + runHook preCheck + $out/bin/gotosocial --help + runHook postCheck + ''; + + postInstall = '' + mkdir -p $out/share/${finalAttrs.pname}/web/{templates,assets} + + cp -r ./web/template/. $out/share/${finalAttrs.pname}/web/template/ + cp -rf ${finalAttrs.frontend-assets}/. $out/share/${finalAttrs.pname}/web/assets/ + + installShellCompletion --cmd gotosocial \ + --bash <($out/bin/gotosocial completion bash) \ + --fish <($out/bin/gotosocial completion fish) \ + --zsh <($out/bin/gotosocial completion zsh) + ''; + + passthru.tests.gotosocial = nixosTests.gotosocial; + + meta = with lib; { + mainProgram = "gotosocial"; + maintainers = [ tgcMaintainers.zaphyra ]; + license = licenses.agpl3Only; + homepage = "https://gotosocial.org"; + changelog = "https://codeberg.org/superseriousbusiness/gotosocial/releases"; + description = "Fast, fun, ActivityPub server, powered by Go"; + longDescription = '' + ActivityPub social network server, written in Golang. + You can keep in touch with your friends, post, read, and + share images and articles. All without being tracked or + advertised to! A light-weight alternative to Mastodon + and Pleroma, with support for clients! + ''; + }; + +})