nixpkgs/pkgs/servers/misc/navidrome/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.5 KiB
Nix
Raw Normal View History

2022-07-09 17:51:23 +02:00
{ callPackage
, buildGoModule
, fetchFromGitHub
, lib
, pkg-config
, stdenv
, ffmpeg
, taglib
, zlib
, makeWrapper
, nixosTests
, ffmpegSupport ? true
}:
2020-06-20 15:08:46 +02:00
2022-07-09 17:51:23 +02:00
let
2020-06-20 15:08:46 +02:00
version = "0.47.5";
2020-06-20 15:08:46 +02:00
2022-07-09 17:51:23 +02:00
src = fetchFromGitHub {
owner = "navidrome";
repo = "navidrome";
rev = "v${version}";
hash = "sha256-gTvJI+brdEpdpbEcdQycqw15seI+k5dMDVrjY3v6i14=";
};
ui = callPackage ./ui {
inherit src version;
};
2022-07-09 17:51:23 +02:00
in
2020-06-20 15:08:46 +02:00
2022-07-09 17:51:23 +02:00
buildGoModule {
2020-06-20 15:08:46 +02:00
2022-07-09 17:51:23 +02:00
pname = "navidrome";
2020-06-20 15:08:46 +02:00
2022-07-09 17:51:23 +02:00
inherit src version;
2021-05-08 02:38:47 +02:00
2022-07-09 17:51:23 +02:00
vendorSha256 = "sha256-xMAxGbq2VSXkF9R9hxB9EEk2CnqsRxg2Nmt7zyXohJI=";
2021-05-08 02:38:47 +02:00
2022-07-09 17:51:23 +02:00
nativeBuildInputs = [ makeWrapper pkg-config ];
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" ];
2022-07-09 17:51:23 +02:00
prePatch = ''
cp -r ${ui}/* ui/build
2020-06-20 15:08:46 +02:00
'';
2022-07-09 17:51:23 +02:00
postFixup = lib.optionalString ffmpegSupport ''
2020-06-20 15:08:46 +02:00
wrapProgram $out/bin/navidrome \
2022-07-09 17:51:23 +02:00
--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
2020-06-20 15:08:46 +02:00
'';
2020-11-22 23:44:46 +01:00
2022-07-09 17:51:23 +02:00
passthru = {
inherit ui;
tests.navidrome = nixosTests.navidrome;
updateScript = callPackage ./update.nix {};
};
2020-06-20 15:08:46 +02:00
meta = {
description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic";
homepage = "https://www.navidrome.org/";
2022-07-09 17:51:23 +02:00
license = lib.licenses.gpl3Only;
sourceProvenance = with lib.sourceTypes; [ fromSource ];
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ aciceri squalus ];
2020-06-20 15:08:46 +02:00
};
}