-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
77 lines (70 loc) · 1.98 KB
/
flake.nix
File metadata and controls
77 lines (70 loc) · 1.98 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
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
{
description = "Explain why two Nix derivations differ";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
packages = {
default = self'.packages.nix-diff;
nix-diff = pkgs.callPackage ./package.nix { };
};
checks =
let
packages = pkgs.lib.mapAttrs' (n: pkgs.lib.nameValuePair "package-${n}") self'.packages;
devShells = pkgs.lib.mapAttrs' (n: pkgs.lib.nameValuePair "devShell-${n}") self'.devShells;
in
packages
// devShells
// {
clippy = pkgs.callPackage ./package.nix { enableClippy = true; };
tests = pkgs.callPackage ./package.nix { enableChecks = true; };
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ];
NIX_CFLAGS_COMPILE = "-Wno-error";
packages = with pkgs; [
cargo
rustc
rust-analyzer
rustfmt
clippy
cargo-watch
cargo-criterion
cargo-insta
];
};
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
rustfmt.enable = true;
alejandra.enable = true;
};
};
};
};
}