-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
63 lines (63 loc) · 1.82 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
{
inputs = {
crane = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:ipetkov/crane";
};
fenix = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/fenix";
};
nix-filter.url = "github:numtide/nix-filter";
nixpkgs.url = "nixpkgs/nixos-unstable";
parts.url = "github:hercules-ci/flake-parts";
pre-commit-hooks = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:cachix/pre-commit-hooks.nix";
};
};
outputs = inputs:
inputs.parts.lib.mkFlake {inherit inputs;} {
imports = [inputs.pre-commit-hooks.flakeModule];
perSystem = {
config,
inputs',
lib,
pkgs,
...
}: let
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
rustToolchain = inputs'.fenix.packages.stable.toolchain;
in {
devShells.default = pkgs.mkShell {
packages = [pkgs.bacon rustToolchain];
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/src";
shellHook = "${config.pre-commit.installationScript}";
};
packages.ghlink = craneLib.buildPackage {
nativeBuildInputs = [pkgs.git] ++ lib.optionals pkgs.stdenv.isDarwin [pkgs.libiconv];
src = inputs.nix-filter.lib {
include = [
"Cargo.lock"
"Cargo.toml"
"src"
"tests"
];
root = ./.;
};
};
pre-commit = {
settings = {
hooks = {
alejandra.enable = true;
deadnix.enable = true;
rustfmt.enable = true;
statix.enable = true;
};
src = ./.;
};
};
};
systems = ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"];
};
}