-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
78 lines (72 loc) · 2.44 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
{
description = "prometheus-weathermen";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
darwin,
rust-overlay,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
cargo-unused-imports = pkgs.rustPlatform.buildRustPackage rec {
pname = "cargo-unused-features";
version = "0.2.0";
src = pkgs.fetchFromGitHub {
owner = "TimonPost";
repo = pname;
rev = version;
hash = "sha256-wpu55tqw41lSpEZu94s9UEwf7Oq0ar5Fhh9ApkhaBtE=";
};
cargoHash = "sha256-K9I7Eg43BS2SKq5zZ3eZrMkmuHAx09OX240sH0eGs+k=";
buildInputs = [
pkgs.openssl
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
meta = {
description = "Potential unused, enabled feature flag finder and pruner";
homepage = "https://github.com/TimonPost/cargo-unused-features";
};
};
configureRust = toolchain: toolchain.default.override { extensions = [ "rust-src" ]; };
createRustEnv =
rust-env:
(pkgs.mkShell {
packages = [
rust-env
cargo-unused-imports
pkgs.cargo-release
pkgs.cargo-duplicates
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
pkgs.darwin.apple_sdk.frameworks.CoreServices
pkgs.openssl
pkgs.pkg-config
];
shellHook = ''
echo "Toolchain: ${pkgs.lib.getBin rust-env}/bin"
echo " rust-std: ${pkgs.lib.getLib rust-env}/lib/rustlib/src/rust/library"
'';
});
in
{
devShells = {
default = createRustEnv (pkgs.rust-bin.selectLatestNightlyWith configureRust);
stable = createRustEnv (configureRust pkgs.rust-bin.stable.latest);
};
}
);
}