forked from qxb3/fum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
91 lines (79 loc) · 2.16 KB
/
flake.nix
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
{
description = "Fum: A fully ricable tui-based music client";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
rustPlatform = pkgs.rustPlatform;
envVars = ''
export OPENSSL_DIR=${pkgs.openssl.dev}
export OPENSSL_LIB_DIR=${pkgs.openssl.out}/lib
export OPENSSL_INCLUDE_DIR=${pkgs.openssl.dev}/include
export DEP_OPENSSL_INCLUDE=${pkgs.openssl.dev}/include
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH=${pkgs.openssl.dev}/lib/pkgconfig:${pkgs.dbus.dev}/lib/pkgconfig
export CARGO_TARGET_DIR=target
'';
fumPackage = rustPlatform.buildRustPackage {
pname = "fum";
version = "v0.4.1";
src = ./.;
cargoHash = "sha256-k3D7y0f3YBcLqMbsjN+Ojj1GIGLNZ5trosj1jHD/71k=";
nativeBuildInputs = with pkgs; [
openssl
pkg-config
dbus
];
buildInputs = with pkgs; [
openssl
dbus
];
buildPhase = ''
${envVars}
cargo build --release
'';
installPhase = ''
mkdir -p $out/bin
cp target/release/fum $out/bin
'';
meta = with pkgs.lib; {
description = "A fully ricable tui-based music client";
license = licenses.mit;
maintainers = ["qxbt" "linuxmobile"];
platforms = platforms.linux;
};
};
in {
defaultPackage = fumPackage;
packages = {
fum = fumPackage;
};
devShells = {
default = pkgs.mkShell {
buildInputs = [pkgs.cargo];
shellHook = ''
${envVars}
'';
};
};
nixosModules = {
fum = import ./modules/default.nix;
};
homeManagerModules = {
fum = {
config,
pkgs,
lib,
...
}:
import ./nix/hm-module.nix {inherit config pkgs lib fumPackage;};
};
});
}