forked from crmne/spotifast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
151 lines (143 loc) · 4.38 KB
/
Copy pathflake.nix
File metadata and controls
151 lines (143 loc) · 4.38 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
description = "Native Navidrome and OpenSubsonic music client";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# rust-toolchain.toml pins the compiler so local builds and CI agree.
# This reads that file rather than restating the version here.
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
...
}:
let
systems = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems =
f:
nixpkgs.lib.genAttrs systems (
system:
f (
import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
}
)
);
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages =
with pkgs;
[
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
rust-analyzer
pkg-config
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
apple-sdk
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
libpulseaudio
libxkbcommon
wayland
libGL
libx11
libxcursor
libxi
libxrandr
];
# The GUI dlopens its Wayland, X11 and GL libraries at run time.
LD_LIBRARY_PATH = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux (
pkgs.lib.makeLibraryPath (
with pkgs;
[
libxkbcommon
wayland
libGL
libx11
libxcursor
libxi
libxrandr
]
)
);
};
});
packages = forAllSystems (pkgs: rec {
default = fastpotify;
fastpotify =
let
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
runtimeLibs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (
with pkgs;
[
libxkbcommon
wayland
libGL
libx11
libxcursor
libxi
libxrandr
]
);
in
rustPlatform.buildRustPackage {
pname = "fastpotify";
version = (pkgs.lib.importTOML ./Cargo.toml).package.version;
src = self;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs =
with pkgs;
[
pkg-config
]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [ makeWrapper ];
buildInputs =
pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (
with pkgs;
[
alsa-lib
libpulseaudio
libGL
]
)
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [ pkgs.apple-sdk ];
# The GUI dlopens its Wayland, X11 and GL libraries at run time.
postFixup = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
wrapProgram $out/bin/fastpotify \
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath runtimeLibs}
'';
postInstall = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
install -Dm644 packaging/applications/fastpotify.desktop \
$out/share/applications/fastpotify.desktop
install -Dm644 packaging/icons/fastpotify.svg \
$out/share/icons/hicolor/scalable/apps/fastpotify.svg
'';
meta = {
description = "Fast native Navidrome and OpenSubsonic client with local playback";
homepage = "https://fastpotify.rocks";
license = pkgs.lib.licenses.mit;
mainProgram = "fastpotify";
};
};
});
formatter = forAllSystems (pkgs: pkgs.nixfmt-tree);
};
}