ctucx.git: nixfiles

ctucx' nixfiles

commit c891cb11e12374194a895f05e49175423c3145c2
parent b4929eb392f63368da052a8ea6d418c977fcc5bd
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 28 Apr 2022 14:28:54 +0200

pkgs: add gotosocial (build from source and as binary from gh-release)
2 files changed, 66 insertions(+), 0 deletions(-)
A
pkgs/gotosocial-bin.nix
|
28
++++++++++++++++++++++++++++
A
pkgs/gotosocial.nix
|
38
++++++++++++++++++++++++++++++++++++++
diff --git a/pkgs/gotosocial-bin.nix b/pkgs/gotosocial-bin.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, fetchurl, autoPatchelfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "gotosocial";
+
+  version = "0.3.1";
+
+  src = fetchurl {
+    url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v${version}/gotosocial_${version}_linux_amd64.tar.gz";
+    sha256 = "11h6dqlndw882325vgw5h4s0aahca6qjvsg02g3qz8ljdiyg8m2q";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+  ];
+
+  sourceRoot = ".";
+
+  installPhase = ''
+    mkdir -p $out/bin;
+    mkdir -p $out/share;
+
+    cp ./gotosocial $out/bin/gotosocial
+    cp -r ./web $out/share/
+
+    chmod +x $out/bin/gotosocial;
+  '';
+}
diff --git a/pkgs/gotosocial.nix b/pkgs/gotosocial.nix
@@ -0,0 +1,38 @@
+{ buildGoModule, fetchFromGitHub, lib, pkgs, ... }:
+
+let
+  pkgsUnstable = import <nixpkgsUnstable> {};
+
+in pkgsUnstable.buildGo118Module rec {
+  pname   = "gotosocial";
+  version = "0.3.0";
+
+  src = fetchFromGitHub {
+    owner  = "superseriousbusiness";
+    repo   = "gotosocial";
+    rev    = "v${version}";
+    sha256 = "0g60vkqqqjh2c0zzl54r630rn54v3wcp0pp3dbnqngs8p1khhaxb";
+  };
+
+  vendorSha256 = null;
+
+#  proxyVendor = true;
+  doCheck     = false;
+
+  installPhase = ''
+    mkdir -p $out
+    mkdir -p $out/share
+
+    dir="$GOPATH/bin"
+    [ -e "$dir" ] && cp -r $dir $out
+
+    cp -r ./web $out/share
+  '';
+
+  meta = with lib; {
+    description = "Golang fediverse server.";
+    homepage    = "https://github.com/superseriousbusiness/gotosocial";
+    license     = licenses.agpl3;
+    platforms   = platforms.linux;
+  };
+}