about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/gotosocial/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/gotosocial/default.nix')
-rw-r--r--nixpkgs/pkgs/servers/gotosocial/default.nix75
1 files changed, 75 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/gotosocial/default.nix b/nixpkgs/pkgs/servers/gotosocial/default.nix
new file mode 100644
index 000000000000..58e916d625f8
--- /dev/null
+++ b/nixpkgs/pkgs/servers/gotosocial/default.nix
@@ -0,0 +1,75 @@
+{ stdenv
+, lib
+, fetchurl
+, fetchFromGitHub
+, buildGoModule
+, nixosTests
+}:
+let
+  owner = "superseriousbusiness";
+  repo = "gotosocial";
+
+  version = "0.14.2";
+
+  web-assets = fetchurl {
+    url = "https://github.com/${owner}/${repo}/releases/download/v${version}/${repo}_${version}_web-assets.tar.gz";
+    hash = "sha256-3aSOP8BTHdlODQnZr6DOZuybLl+02SWgP9YZ21guAPU=";
+  };
+in
+buildGoModule rec {
+  inherit version;
+  pname = repo;
+
+  src = fetchFromGitHub {
+    inherit owner repo;
+    rev = "refs/tags/v${version}";
+    hash = "sha256-oeOxP9FkGsOH66Uk946H0b/zggz536YvRRuo1cINxSM=";
+  };
+
+  vendorHash = null;
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X main.Version=${version}"
+  ];
+
+  postInstall = ''
+    tar xf ${web-assets}
+    mkdir -p $out/share/gotosocial
+    mv web $out/share/gotosocial/
+  '';
+
+  # tests are working only on x86_64-linux
+  doCheck = stdenv.isLinux && stdenv.isx86_64;
+
+  checkFlags =
+    let
+      # flaky / broken tests
+      skippedTests = [
+        # See: https://github.com/superseriousbusiness/gotosocial/issues/2651
+        "TestPage/minID,_maxID_and_limit_set"
+        # See: https://github.com/superseriousbusiness/gotosocial/pull/2760. Stop skipping
+        # this test when fixed for go 1.21.8 and above
+        "TestValidationTestSuite/TestValidateEmail"
+      ];
+    in
+    [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
+
+  passthru.tests.gotosocial = nixosTests.gotosocial;
+
+  meta = with lib; {
+    homepage = "https://gotosocial.org";
+    changelog = "https://github.com/superseriousbusiness/gotosocial/releases/tag/v${version}";
+    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!
+    '';
+    maintainers = with maintainers; [ misuzu blakesmith ];
+    license = licenses.agpl3Only;
+  };
+}