about summary refs log tree commit diff
path: root/pkgs/servers/polaris/default.nix
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2022-06-17 20:03:34 +0200
committerYt <happysalada@proton.me>2022-07-08 12:27:48 -0400
commit50ba995a1c1a1a6403d3bd45f99d09d02492ff56 (patch)
tree8f40ad30ee7c22a6c92761351cc6822c7b1163c3 /pkgs/servers/polaris/default.nix
parent97039777aa04b646510e3351a6b72e12e3215115 (diff)
polaris: init at 0.13.5
Polaris is a self-hosted music streaming server, with a
web and android frontend. The web frontend is included.
https://github.com/agersant/polaris

Polaris-web uses an odd versioning schema: 'build-X'. We reuse
the upstream tags. Polaris CI releases automatically bundle the
latest available version of polaris-web, however 'polaris' has seen
no release since april 2021, while polaris-web has had 5 version
bumps since. Currently we package the version of polaris-web
bundled with polaris on github. Once the newer versions are tested
we might upgrade.
Diffstat (limited to 'pkgs/servers/polaris/default.nix')
-rw-r--r--pkgs/servers/polaris/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/pkgs/servers/polaris/default.nix b/pkgs/servers/polaris/default.nix
new file mode 100644
index 0000000000000..fb9384ea05185
--- /dev/null
+++ b/pkgs/servers/polaris/default.nix
@@ -0,0 +1,56 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, rustPlatform
+, polaris-web
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "polaris";
+  version = "0.13.5";
+
+  src = fetchFromGitHub {
+    owner = "agersant";
+    repo = "polaris";
+    rev = "${version}";
+    sha256 = "sp1KDTzKvcGtuqL37fFnVgcnkIsmj5ZQji72BeyiFQE=";
+
+    # The polaris version upstream in Cargo.lock is "0.0.0".
+    # We're unable to simply patch it in the patch phase due to
+    # rustPlatform.buildRustPackage fetching dependencies before applying patches.
+    # If we patch it after fetching dependencies we get an error when
+    # validating consistency between the final build and the prefetched deps.
+    postFetch = ''
+      # 'substituteInPlace' does not support multiline replacements?
+      sed -i $out/Cargo.lock -z \
+        -e 's/\[\[package\]\]\nname = "polaris"\nversion = "0.0.0"/[[package]]\nname = "polaris"\nversion = "'"${version}"'"/g'
+    '';
+  };
+
+  cargoSha256 = "sha256-0VHrlUoyYu+UTUQUioftBDlQJfLd/axz6bGJs+YXSmE=";
+
+  # Compile-time environment variables for where to find assets needed at runtime
+  POLARIS_WEB_DIR = "${polaris-web}/share/polaris-web";
+  POLARIS_SWAGGER_DIR = "${placeholder "out"}/share/polaris-swagger";
+
+  postInstall = ''
+    mkdir -p $out/share
+    cp -a docs/swagger $out/share/polaris-swagger
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  meta = with lib; {
+    description = "Self-host your music collection, and access it from any computer and mobile device";
+    longDescription = ''
+      Polaris is a FOSS music streaming application, designed to let you enjoy your music collection
+      from any computer or mobile device. Polaris works by streaming your music directly from your
+      own computer, without uploading it to a third-party. There are no  kind of premium version.
+      The only requirement is that your computer stays on while it streams your music!
+    '';
+    homepage = "https://github.com/agersant/polaris";
+    license = licenses.mit;
+    maintainers = with maintainers; [ pbsds ];
+    platforms = platforms.unix;
+  };
+}