nixpkgs/pkgs/by-name/go/gonic/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

64 lines
1.7 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub
, nixosTests
, pkg-config, taglib, zlib
# Disable on-the-fly transcoding,
# removing the dependency on ffmpeg.
# The server will (as of 0.11.0) gracefully fall back
# to the original file, but if transcoding is configured
# that takes a while. So best to disable all transcoding
# in the configuration if you disable transcodingSupport.
, transcodingSupport ? true, ffmpeg
, mpv }:
buildGoModule rec {
pname = "gonic";
version = "0.16.4";
src = fetchFromGitHub {
owner = "sentriz";
repo = pname;
rev = "v${version}";
sha256 = "sha256-+8rKODoADU2k1quKvbijjs/6S/hpkegHhG7Si0LSE0k=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ taglib zlib ];
vendorHash = "sha256-6JkaiaAgtXYAZqVSRZJFObZvhEsHsbPaO9pwmKqIhYI=";
# TODO(Profpatsch): write a test for transcoding support,
# since it is prone to break
postPatch = lib.optionalString transcodingSupport ''
substituteInPlace \
transcode/transcode.go \
--replace-fail \
'`ffmpeg' \
'`${lib.getBin ffmpeg}/bin/ffmpeg'
'' + ''
substituteInPlace \
jukebox/jukebox.go \
--replace-fail \
'"mpv"' \
'"${lib.getBin mpv}/bin/mpv"'
'' + ''
substituteInPlace server/ctrlsubsonic/testdata/test* \
--replace-quiet \
'"audio/flac"' \
'"audio/x-flac"'
'';
passthru = {
tests.gonic = nixosTests.gonic;
};
# tests require it
__darwinAllowLocalNetworking = true;
meta = {
homepage = "https://github.com/sentriz/gonic";
description = "Music streaming server / subsonic server API implementation";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ autrimpo ];
mainProgram = "gonic";
};
}