mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-01 02:23:54 +00:00
e0816431a2
Otherwise references to the Python interpreter inside the set are wrong, as demonstrated by: ``` nix with import <nixpkgs> { }; let python' = python3.override { packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337"; }); }; }; in python'.pkgs.python.pkgs.requests ``` which returns the _non_ overriden requests. And the same with `self`: ``` with import <nixpkgs> { }; let python' = python3.override { self = python'; packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337"; }); }; }; in python'.pkgs.python.pkgs.requests ``` which returns the overriden requests. This can manifest itself as file collisions when constructing environments or as subtly incorrect dependency graphs.
121 lines
2.8 KiB
Nix
121 lines
2.8 KiB
Nix
{ lib
|
|
, python3
|
|
, fetchFromGitHub
|
|
, ffmpeg-headless
|
|
, nixosTests
|
|
, substituteAll
|
|
, providers ? [ ]
|
|
}:
|
|
|
|
let
|
|
python = python3.override {
|
|
self = python;
|
|
packageOverrides = self: super: {
|
|
music-assistant-frontend = self.callPackage ./frontend.nix { };
|
|
};
|
|
};
|
|
|
|
providerPackages = (import ./providers.nix).providers;
|
|
providerNames = lib.attrNames providerPackages;
|
|
providerDependencies = lib.concatMap (provider: (providerPackages.${provider} python.pkgs)) providers;
|
|
|
|
pythonPath = python.pkgs.makePythonPath providerDependencies;
|
|
in
|
|
|
|
python.pkgs.buildPythonApplication rec {
|
|
pname = "music-assistant";
|
|
version = "2.0.7";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "music-assistant";
|
|
repo = "server";
|
|
rev = version;
|
|
hash = "sha256-JtdlZ3hH4fRU5TjmMUlrdSSCnLrIGCuSwSSrnLgjYEs=";
|
|
};
|
|
|
|
patches = [
|
|
(substituteAll {
|
|
src = ./ffmpeg.patch;
|
|
ffmpeg = "${lib.getBin ffmpeg-headless}/bin/ffmpeg";
|
|
ffprobe = "${lib.getBin ffmpeg-headless}/bin/ffprobe";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
sed -i "/--cov/d" pyproject.toml
|
|
|
|
substituteInPlace pyproject.toml \
|
|
--replace-fail "0.0.0" "${version}"
|
|
'';
|
|
|
|
build-system = with python.pkgs; [
|
|
setuptools
|
|
];
|
|
|
|
dependencies = with python.pkgs; [
|
|
aiohttp
|
|
mashumaro
|
|
orjson
|
|
] ++ optional-dependencies.server;
|
|
|
|
optional-dependencies = with python.pkgs; {
|
|
server = [
|
|
aiodns
|
|
aiofiles
|
|
aiohttp
|
|
aiorun
|
|
aiosqlite
|
|
asyncio-throttle
|
|
brotli
|
|
certifi
|
|
colorlog
|
|
cryptography
|
|
faust-cchardet
|
|
ifaddr
|
|
mashumaro
|
|
memory-tempfile
|
|
music-assistant-frontend
|
|
orjson
|
|
pillow
|
|
python-slugify
|
|
shortuuid
|
|
unidecode
|
|
xmltodict
|
|
zeroconf
|
|
];
|
|
};
|
|
|
|
nativeCheckInputs = with python.pkgs; [
|
|
ffmpeg-headless
|
|
pytest-aiohttp
|
|
pytestCheckHook
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
|
|
|
pythonImportsCheck = [ "music_assistant" ];
|
|
|
|
passthru = {
|
|
inherit
|
|
python
|
|
pythonPath
|
|
providerPackages
|
|
providerNames
|
|
;
|
|
tests = nixosTests.music-assistant;
|
|
};
|
|
|
|
meta = with lib; {
|
|
changelog = "https://github.com/music-assistant/server/releases/tag/${version}";
|
|
description = "Music Assistant is a music library manager for various music sources which can easily stream to a wide range of supported players";
|
|
longDescription = ''
|
|
Music Assistant is a free, opensource Media library manager that connects to your streaming services and a wide
|
|
range of connected speakers. The server is the beating heart, the core of Music Assistant and must run on an
|
|
always-on device like a Raspberry Pi, a NAS or an Intel NUC or alike.
|
|
'';
|
|
homepage = "https://github.com/music-assistant/server";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ hexa ];
|
|
mainProgram = "mass";
|
|
};
|
|
}
|