-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
102 lines (86 loc) · 2.32 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
description = "hadron";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
code-nix = {
url = "github:fxttr/code-nix";
inputs = {
nixpkgs.follows = "nixpkgs";
extensions.follows = "nix-vscode-extensions";
};
};
crane = {
url = "github:ipetkov/crane";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
};
fenix-channel = inputs.fenix.packages.${system}.latest;
fenix-toolchain = (fenix-channel.withComponents [
"rustc"
"cargo"
"clippy"
"rust-analysis"
"rust-src"
"rustfmt"
"llvm-tools-preview"
]);
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain fenix-toolchain;
hadron = craneLib.buildPackage {
src = craneLib.cleanCargoSource ./.;
doCheck = false;
buildInputs = [ ];
};
code = inputs.code-nix.packages.${system}.default;
in
{
checks = {
inherit hadron;
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
rustfmt.enable = true;
};
};
};
packages.default = hadron;
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks;
nativeBuildInputs = with pkgs; [
fenix-toolchain
rust-analyzer
qemu
parted
xorriso
gdb
(code {
profiles = {
nix = {
enable = true;
};
rust = {
enable = true;
};
};
})
];
};
});
}