-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathflake.nix
More file actions
94 lines (79 loc) · 2.23 KB
/
flake.nix
File metadata and controls
94 lines (79 loc) · 2.23 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
{
description = "Nix flake for xfr";
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; };
lib = pkgs.lib;
rustToolchain = with pkgs; [
cargo
clippy
rustc
rustfmt
];
xfr = pkgs.rustPlatform.buildRustPackage {
pname = "xfr";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [
installShellFiles
pkg-config
];
buildInputs = with pkgs;
lib.optionals stdenv.isDarwin [
libiconv
SystemConfiguration
];
doCheck = true;
postInstall = ''
$out/bin/xfr --completions bash > xfr.bash
$out/bin/xfr --completions fish > xfr.fish
$out/bin/xfr --completions zsh > _xfr
installShellCompletion --cmd xfr \
--bash xfr.bash \
--fish xfr.fish \
--zsh _xfr
install -Dm644 docs/xfr.1 $out/share/man/man1/xfr.1
'';
meta = with lib; {
description = "Modern network bandwidth testing with TUI";
homepage = "https://github.com/lance0/xfr";
license = with licenses; [ mit asl20 ];
mainProgram = "xfr";
platforms = platforms.unix;
};
};
in
{
packages = {
default = xfr;
xfr = xfr;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ xfr ];
packages = with pkgs;
rustToolchain
++ [
cargo-audit
cargo-nextest
rust-analyzer
];
shellHook = ''
echo "xfr development shell"
echo "Available commands: cargo build, cargo test --all-features, cargo clippy --all-features"
'';
};
}
);
}