depot/third_party/nixpkgs/pkgs/by-name/na/navidrome/package.nix
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

87 lines
2 KiB
Nix

{ buildGoModule
, buildPackages
, fetchFromGitHub
, fetchNpmDeps
, lib
, nodejs
, npmHooks
, pkg-config
, stdenv
, ffmpeg-headless
, taglib
, zlib
, nixosTests
, nix-update-script
, ffmpegSupport ? true
}:
buildGoModule rec {
pname = "navidrome";
version = "0.52.5";
src = fetchFromGitHub {
owner = "navidrome";
repo = "navidrome";
rev = "v${version}";
hash = "sha256-M1BxR4Mmkfbr9Wb2YwWEeVGgKOCtD/8pgFZiv8mTi7s=";
};
vendorHash = "sha256-puldHJs5GiaXvyvwuzAX00nMLUxoBESpxLOEtBYD7o4=";
npmRoot = "ui";
npmDeps = fetchNpmDeps {
inherit src;
sourceRoot = "${src.name}/ui";
hash = "sha256-OZvEPC+MobCJn16d3MsMtrStbsmRD9Ef0/leVSXtVZ8=";
};
nativeBuildInputs = [
buildPackages.makeWrapper
nodejs
npmHooks.npmConfigHook
pkg-config
];
overrideModAttrs = oldAttrs: {
nativeBuildInputs = lib.filter (drv: drv != npmHooks.npmConfigHook) oldAttrs.nativeBuildInputs;
preBuild = null;
};
buildInputs = [
taglib
zlib
];
ldflags = [
"-X github.com/navidrome/navidrome/consts.gitSha=${src.rev}"
"-X github.com/navidrome/navidrome/consts.gitTag=v${version}"
];
CGO_CFLAGS = lib.optionals stdenv.cc.isGNU [ "-Wno-return-local-addr" ];
preBuild = ''
make buildjs
'';
postFixup = lib.optionalString ffmpegSupport ''
wrapProgram $out/bin/navidrome \
--prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]}
'';
passthru = {
tests.navidrome = nixosTests.navidrome;
updateScript = nix-update-script { };
};
meta = {
description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic";
mainProgram = "navidrome";
homepage = "https://www.navidrome.org/";
license = lib.licenses.gpl3Only;
sourceProvenance = with lib.sourceTypes; [ fromSource ];
maintainers = with lib.maintainers; [ aciceri squalus ];
# Broken on Darwin: sandbox-exec: pattern serialization length exceeds maximum (NixOS/nix#4119)
broken = stdenv.isDarwin;
};
}