-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathflake.nix
52 lines (50 loc) · 1.37 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{
self,
nixpkgs,
rust-overlay,
}:
let
overlays = [ (import rust-overlay) ];
forAllSystems =
function:
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
system: function (import nixpkgs { inherit system overlays; })
);
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in
{
packages = forAllSystems (pkgs: rec {
default = md-tui;
md-tui =
(pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
}).buildRustPackage
{
inherit (cargoToml.package) name version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
meta.mainProgram = "mdt";
};
});
devShells = forAllSystems (
pkgs:
let
toolchain = pkgs.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; };
in
{
default = pkgs.mkShell {
buildInputs = [ toolchain ];
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
RUST_BACKTRACE = 1;
};
}
);
};
}