about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/web-apps/pixelfed/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/web-apps/pixelfed/default.nix')
-rw-r--r--nixpkgs/pkgs/servers/web-apps/pixelfed/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/web-apps/pixelfed/default.nix b/nixpkgs/pkgs/servers/web-apps/pixelfed/default.nix
new file mode 100644
index 000000000000..2b1f2e730206
--- /dev/null
+++ b/nixpkgs/pkgs/servers/web-apps/pixelfed/default.nix
@@ -0,0 +1,49 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, php
+, nixosTests
+, nix-update-script
+, dataDir ? "/var/lib/pixelfed"
+, runtimeDir ? "/run/pixelfed"
+}:
+
+php.buildComposerProject (finalAttrs: {
+  pname = "pixelfed";
+  version = "0.11.13";
+
+  src = fetchFromGitHub {
+    owner = "pixelfed";
+    repo = finalAttrs.pname;
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-bEwKaC9fSOGLQbjsuPuIdMMbO3kzvzQxWQR8C2A4mQc=";
+  };
+
+  vendorHash = "sha256-ahQsOq3qOMGt3b0Ebac4xex+MP9knTmjyCy0PSNE4W8=";
+
+  postInstall = ''
+    mv "$out/share/php/${finalAttrs.pname}"/* $out
+    rm -R $out/bootstrap/cache
+    # Move static contents for the NixOS module to pick it up, if needed.
+    mv $out/bootstrap $out/bootstrap-static
+    mv $out/storage $out/storage-static
+    ln -s ${dataDir}/.env $out/.env
+    ln -s ${dataDir}/storage $out/
+    ln -s ${dataDir}/storage/app/public $out/public/storage
+    ln -s ${runtimeDir} $out/bootstrap
+    chmod +x $out/artisan
+  '';
+
+  passthru = {
+    tests = { inherit (nixosTests) pixelfed; };
+    updateScript = nix-update-script { };
+  };
+
+  meta = with lib; {
+    description = "A federated image sharing platform";
+    license = licenses.agpl3Only;
+    homepage = "https://pixelfed.org/";
+    maintainers = with maintainers; [ raitobezarius ];
+    platforms = php.meta.platforms;
+  };
+})