-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
69 lines (65 loc) · 1.81 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
{
description = "farbenfroh - web app for faerber";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
flake-utils,
rust-overlay,
pre-commit-hooks,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# rust
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
binaryen
openssl
pkg-config
wasm-bindgen-cli
wasm-pack
# node
nodejs_20
(pkgs.yarn.override {
nodejs = nodejs_20;
})
];
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
'';
};
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
# custom wasm clippy version
clippy-wasm = {
enable = true;
name = "clippy";
description = "Lint Rust code.";
entry = "cargo clippy --target wasm32-unknown-unknown";
files = "\\.rs$";
pass_filenames = false;
};
rustfmt.enable = true;
prettier.enable = true;
};
};
};
}
);
}