-
Notifications
You must be signed in to change notification settings - Fork 18
/
shell.nix
62 lines (60 loc) · 1.36 KB
/
shell.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
{
system ? builtins.currentSystem,
}:
let
pins = import ./npins;
pkgs = import pins.nixpkgs {
inherit system;
overlays = [
(self: super: {
nixfmt = super.nixfmt-classic.overrideAttrs (old: {
src = pins.nixfmt;
});
})
];
};
inherit (pkgs) stdenv lib;
pre-commit = (import pins."pre-commit-hooks.nix").run {
src = ./.;
tools.nixfmt = pkgs.nixfmt; # Why don't they just take it from our pkgs?
hooks = {
nixfmt = {
enable = true;
settings.width = 100;
};
rustfmt.enable = true;
update-readme = {
enable = true;
files = "((^README\\.md\\.in|^README\\.md|^readme\\.nix|^Cargo\\.toml)|\\.rs)$";
entry = toString (
pkgs.writeShellScript "update-readme" ''
${pkgs.nix}/bin/nix-build ${toString ./readme.nix} -o readme && cp readme README.md
exec ${pkgs.git}/bin/git diff --quiet --exit-code -- README.md
''
);
};
};
};
in
pkgs.mkShell {
nativeBuildInputs =
with pkgs;
[
cargo
cargo-expand
clippy
rustc
rust-analyzer
rustfmt
nixfmt
nix_2_3
nix-prefetch-git
git
npins
]
++ (lib.optionals stdenv.isDarwin [
pkgs.libiconv
pkgs.darwin.apple_sdk.frameworks.Security
]);
inherit (pre-commit) shellHook;
}