-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
62 lines (57 loc) · 1.79 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
{
description = "A Rust-based tool to compare files between two directories by hash";
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;
};
in
{
packages = {
default = pkgs.rustPlatform.buildRustPackage {
pname = "filematch";
version = "0.1.1";
description = "Compares files between two directories by hash";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
license = pkgs.lib.licenses.gpl3Plus.fullName;
};
};
devShell = pkgs.mkShell {
nativeBuildInputs = [
pkgs.rustc
pkgs.cargo
pkgs.rustfmt
pkgs.clippy
pkgs.cargo-bloat
pkgs.cargo-audit
pkgs.cargo-flamegraph
];
};
# App output to run benchmarks using `nix run .#bench`
apps.bench = let
benchScript = pkgs.writeShellScriptBin "cargo-bench-wrapper" ''
# Ensure cargo, rustc, and gcc are in PATH.
# Explicitly set the C compiler.
# Use a temporary writable directory for cargo's target.
export PATH="${pkgs.cargo}/bin:${pkgs.rustc}/bin:${pkgs.gcc}/bin:$PATH"
export CARGO_TARGET_DIR=$(mktemp -d -t cargo-target-XXXXXX)
cd ${toString ./.}
cargo bench --bench benchmark
'';
benchEnv = pkgs.buildEnv {
name = "bench-env";
paths = [ benchScript pkgs.rustc pkgs.cargo pkgs.gcc ];
};
in {
type = "app";
program = "${benchEnv}/bin/cargo-bench-wrapper";
};
});
}