-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
68 lines (55 loc) · 1.6 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
{
description = "rust-nix-monorepo-template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
cargo2nix = {
url = "github:cargo2nix/cargo2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, flake-utils, nixpkgs, rust-overlay, cargo2nix, ... }:
let
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
in
flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
cargo2nix.overlays.default
];
};
rustVersion = "1.72.0";
rust-toolchain = pkgs.rust-bin.stable."${rustVersion}".overrides {
extensions = [ "rust-src" "clippy" "rustfmt" ];
};
rustPkgs = pkgs.rustBuilder.makePackageSet {
inherit rustVersion;
packageFun = import ./Cargo.nix;
};
cli = (rustPkgs.workspace.cli { });
in
rec {
packages = {
inherit cli;
default = packages.cli;
};
apps = {
cli = flake-utils.lib.mkApp {
drv = packages.cli;
};
default = apps.cli;
};
devShells.default = pkgs.mkShell {
buildInputs = [ rust-toolchain ];
};
}
);
}