Commit 97588fcd authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by Yt
Browse files

polaris: 0.13.5 -> 0.14.0

I also swapped the updateScript, as the old one didn't touch the cargo hash.
parent 96d403ee
Loading
Loading
Loading
Loading
+2497 −0

File added.

Preview size limit exceeded, changes collapsed.

+24 −6
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, nix-update-script
, polaris-web
, darwin
}:

rustPlatform.buildRustPackage rec {
  pname = "polaris";
  version = "0.13.5";
  version = "0.14.0";

  src = fetchFromGitHub {
    owner = "agersant";
    repo = "polaris";
    rev = version;
    sha256 = "sp1KDTzKvcGtuqL37fFnVgcnkIsmj5ZQji72BeyiFQE=";
    hash = "sha256-mLugPi3Xp46Lh48JQVeyOEGiovSF26gUt25MGBPFfkM=";

    # The polaris version upstream in Cargo.lock is "0.0.0".
    # We're unable to simply patch it in the patch phase due to
@@ -26,11 +29,22 @@ rustPlatform.buildRustPackage rec {
    '';
  };

  cargoSha256 = "sha256-0VHrlUoyYu+UTUQUioftBDlQJfLd/axz6bGJs+YXSmE=";
  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "id3-1.4.0" = "sha256-0j2iOd/GkMqLu18Eu8nttmqez0G6fu2m19gsHWMmLds=";
    };
  };

  buildInputs = lib.optionals stdenv.isDarwin [
    darwin.Security
  ];

  # Compile-time environment variables for where to find assets needed at runtime
  env = {
    POLARIS_WEB_DIR = "${polaris-web}/share/polaris-web";
    POLARIS_SWAGGER_DIR = "${placeholder "out"}/share/polaris-swagger";
  };

  postInstall = ''
    mkdir -p $out/share
@@ -42,7 +56,11 @@ rustPlatform.buildRustPackage rec {
    ulimit -n 4096
  '';

  passthru.updateScript = ./update.sh;
  __darwinAllowLocalNetworking = true;

  passthru.updateScript = nix-update-script {
    attrPath = pname;
  };

  meta = with lib; {
    description = "Self-host your music collection, and access it from any computer and mobile device";

pkgs/servers/polaris/update.sh

deleted100755 → 0
+0 −18
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl jq nix coreutils

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"/../../..

# update github tag and hash

latestVersion="$(curl -s "https://api.github.com/repos/agersant/polaris/releases?per_page=1" | jq -r ".[0].tag_name")"
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; polaris.version or (lib.getVersion polaris)" | tr -d '"')

if [[ "$currentVersion" == "$latestVersion" ]]; then
  echo "polaris is up-to-date: $currentVersion"
  exit 0
fi

update-source-version polaris "$latestVersion"