forked from vladkens/macmon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
51 lines (49 loc) · 1.4 KB
/
flake.nix
File metadata and controls
51 lines (49 loc) · 1.4 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
{
description = "Build a cargo project without extra checks";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs:
let
system = "aarch64-darwin";
pkgs = inputs.nixpkgs.legacyPackages.${system};
craneLib = inputs.crane.mkLib pkgs;
commonArgs = {
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
};
macmon = craneLib.buildPackage (
commonArgs
// {
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
}
);
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
rustfmt.enable = true;
};
};
in
{
formatter.${system} = treefmtEval.config.build.wrapper;
checks.${system} = {
formatting = treefmtEval.config.build.check inputs.self;
inherit macmon;
};
packages.${system}.default = macmon;
devShells.${system}.default = craneLib.devShell {
inputsFrom = [ macmon ];
checks = inputs.self.checks.${system};
packages = with pkgs; [ bacon ];
env = {
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
};
};
};
}