Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
89 lines (76 loc) · 3.07 KB
/
Copy pathflake.nix
File metadata and controls
89 lines (76 loc) · 3.07 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
{
description = "gtm – terminal-based music player daemon and client";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
};
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "gtm";
version = "0.2.83";
src = ./.;
nativeBuildInputs = [ rustToolchain pandoc ];
buildInputs = with pkgs; [ alsa-lib ];
buildPhase = ''
cargo build --release --workspace
'';
installPhase = ''
# Binaries
install -Dm 0755 target/release/gtmd $out/bin/gtmd
install -Dm 0755 target/release/gtm $out/bin/gtm
# Systemd user service
install -Dm 0644 dist/gtmd.service $out/lib/systemd/user/gtmd.service
# Man pages
mkdir -p artifacts/man
bash scripts/build/manpages.sh artifacts
install -Dm 0644 artifacts/man/gtmd.1 $out/share/man/man1/gtmd.1
install -Dm 0644 artifacts/man/gtmd-ipc.1 $out/share/man/man1/gtmd-ipc.1
install -Dm 0644 artifacts/man/gtm.1 $out/share/man/man1/gtm.1
# Shell completions, emitted by the binaries built above
./scripts/build/completions.sh "$(pwd)/artifacts"
install -Dm 0644 artifacts/completions/gtm.bash $out/share/bash-completion/completions/gtm
install -Dm 0644 artifacts/completions/_gtm $out/share/zsh/site-functions/_gtm
install -Dm 0644 artifacts/completions/gtm.fish $out/share/fish/vendor_completions.d/gtm.fish
install -Dm 0644 artifacts/completions/gtmd.bash $out/share/bash-completion/completions/gtmd
install -Dm 0644 artifacts/completions/_gtmd $out/share/zsh/site-functions/_gtmd
install -Dm 0644 artifacts/completions/gtmd.fish $out/share/fish/vendor_completions.d/gtmd.fish
# Desktop file
install -Dm 0644 dist/gtm.desktop $out/share/applications/gtm.desktop
'';
checkPhase = ''
cargo test --workspace
'';
meta = with pkgs.lib; {
description = "Terminal-based music player daemon and client";
homepage = "https://github.com/prjctimg/gtm";
license = licenses.gpl3Only;
maintainers = [ "prjctimg <prjctimg@outlook.com>" ];
platforms = platforms.linux;
};
};
devShells.default = pkgs.mkShell {
buildInputs = [ rustToolchain pkgs.alsa-lib pkgs.pandoc pkgs.cargo-deb ];
};
}
);
}