2022-06-17 18:03:34 +00:00
|
|
|
{ lib
|
2022-11-26 23:08:06 +00:00
|
|
|
, stdenv
|
2022-06-17 18:03:34 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
2022-11-26 23:08:06 +00:00
|
|
|
, nix-update-script
|
2022-06-17 18:03:34 +00:00
|
|
|
, polaris-web
|
2022-11-26 23:08:06 +00:00
|
|
|
, darwin
|
2023-09-30 15:29:02 +00:00
|
|
|
, nixosTests
|
2022-06-17 18:03:34 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "polaris";
|
2024-10-01 00:15:48 +00:00
|
|
|
version = "0.14.3";
|
2022-06-17 18:03:34 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "agersant";
|
|
|
|
repo = "polaris";
|
2023-07-02 18:50:45 +00:00
|
|
|
rev = version;
|
2024-10-01 00:15:48 +00:00
|
|
|
hash = "sha256-2GHYIlEzRS7KXahdrxMjyIcPCNw8gXJw5/4ZpB/zT3Y=";
|
2022-06-17 18:03:34 +00:00
|
|
|
|
|
|
|
# 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'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-10-01 00:15:48 +00:00
|
|
|
cargoHash = if stdenv.buildPlatform.isDarwin
|
|
|
|
then "sha256-HTqsghjfSjwOaN/ApPFvWVEoquZzE3MYzULkhUOXIWI"
|
|
|
|
else "sha256-Z3AbYtdNAyKT5EuGtCktEg0fxs/gpKdsrttRkxZhLAU";
|
2022-11-26 23:08:06 +00:00
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
darwin.Security
|
|
|
|
];
|
2022-06-17 18:03:34 +00:00
|
|
|
|
|
|
|
# Compile-time environment variables for where to find assets needed at runtime
|
2022-11-26 23:08:06 +00:00
|
|
|
env = {
|
|
|
|
POLARIS_WEB_DIR = "${polaris-web}/share/polaris-web";
|
|
|
|
POLARIS_SWAGGER_DIR = "${placeholder "out"}/share/polaris-swagger";
|
|
|
|
};
|
2022-06-17 18:03:34 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -a docs/swagger $out/share/polaris-swagger
|
|
|
|
'';
|
|
|
|
|
2022-07-12 23:30:11 +00:00
|
|
|
preCheck = ''
|
|
|
|
# 'Err' value: Os { code: 24, kind: Uncategorized, message: "Too many open files" }
|
|
|
|
ulimit -n 4096
|
|
|
|
'';
|
|
|
|
|
2022-11-26 23:08:06 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2023-09-30 15:29:02 +00:00
|
|
|
passthru.tests = nixosTests.polaris;
|
2024-08-13 16:02:24 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2022-06-17 18:03:34 +00:00
|
|
|
|
|
|
|
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;
|
2023-11-23 21:09:35 +00:00
|
|
|
mainProgram = "polaris";
|
2022-06-17 18:03:34 +00:00
|
|
|
};
|
|
|
|
}
|