-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathflake.nix
More file actions
92 lines (89 loc) · 2.6 KB
/
flake.nix
File metadata and controls
92 lines (89 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
description = "Mopidy Extension for Tidal music service integration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs @ {
nixpkgs,
flake-parts,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = nixpkgs.lib.systems.flakeExposed;
perSystem = {
self',
pkgs,
...
}: let
pyProject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
inherit (pyProject.project) version;
python = pkgs.python3.withPackages (ps: [ps.gst-python ps.pygobject3]);
buildInputs =
[
python
]
++ (with pkgs; [
# dev
uv
pre-commit
ruff
# deps
mopidy # for its build inputs, and local testing
gobject-introspection
glib-networking
# integration tests
mpc
mopidy-mpd
# local testing
mopidy-local
mopidy-iris
])
++ (with pkgs.gst_all_1; [
gst-plugins-bad
gst-plugins-base
gst-plugins-good
gst-plugins-ugly
gst-plugins-rs
]);
in {
devShells.default = pkgs.mkShell {
packages = buildInputs;
env = {
UV_PROJECT_ENVIRONMENT = ".direnv/venv";
# libsoup_3 is broken, and why wouldn't you use curl?
GST_PLUGIN_FEATURE_RANK = "curlhttpsrc:MAX";
};
shellHook = ''
# pre-commit install
[ ! -d $UV_PROJECT_ENVIRONMENT ] && uv venv $UV_PROJECT_ENVIRONMENT --python ${python}/bin/python
source $UV_PROJECT_ENVIRONMENT/bin/activate
'';
};
packages = {
default = self'.packages.mopidy-tidal;
mopidy-tidal = pkgs.python3Packages.buildPythonApplication {
pname = "mopidy-tidal";
inherit version;
pyproject = true;
src = ./.;
build-system = [pkgs.python3Packages.uv-build];
nativeCheckInputs = with pkgs.python3Packages; [
pytestCheckHook
pytest-asyncio
pytest-cov # since default pytest invocation includes --cov
pytest-mock
pytest-httpserver
pytest-cases
trustme
httpx
];
dependencies = [
pkgs.mopidy
pkgs.python3Packages.tidalapi
];
};
};
};
};
}