-
Notifications
You must be signed in to change notification settings - Fork 46
/
shell.nix
81 lines (74 loc) · 2.12 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
sources ? import ./sources.nix,
nixpkgs ? sources.nixpkgs,
niv ? sources.niv,
mkCli ? sources.mkCli,
rust-overlay ? sources.rust-overlay,
}: let
niv-overlay = self: _: {
niv = self.symlinkJoin {
name = "niv";
paths = [niv];
buildInputs = [self.makeWrapper];
postBuild = ''
wrapProgram $out/bin/niv \
--add-flags "--sources-file ${toString ./sources.json}"
'';
};
};
mkCli-overlay = import "${mkCli}/overlay.nix";
pkgs = import nixpkgs {
overlays = [
niv-overlay
mkCli-overlay
(import rust-overlay)
];
config = {};
};
cli = pkgs.lib.mkCli "cli" {
_noAll = true;
install = "${pkgs.nodejs}/bin/npm ci";
start = "${pkgs.nodejs}/bin/npm run -w staking build && ${pkgs.nodejs}/bin/npm run -w frontend dev";
test = {
nix = {
lint = "${pkgs.statix}/bin/statix check --ignore node_modules .";
dead-code = "${pkgs.deadnix}/bin/deadnix --exclude ./node_modules .";
format = "${pkgs.alejandra}/bin/alejandra --exclude ./node_modules --check .";
};
frontend = {
lint = "${pkgs.nodejs}/bin/npm run -w frontend test:lint";
types = "${pkgs.nodejs}/bin/npm run -w frontend test:types";
format = "${pkgs.nodejs}/bin/npm run -w frontend test:format";
};
};
fix = {
nix = {
lint = "${pkgs.statix}/bin/statix fix --ignore node_modules .";
dead-code = "${pkgs.deadnix}/bin/deadnix --exclude ./node_modules -e .";
format = "${pkgs.alejandra}/bin/alejandra --exclude ./node_modules .";
};
frontend = {
lint = "${pkgs.nodejs}/bin/npm run -w frontend fix:lint";
format = "${pkgs.nodejs}/bin/npm run -w frontend fix:format";
};
};
};
in
pkgs.mkShell {
FORCE_COLOR = 1;
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [
cli
pkgs.git
pkgs.niv
pkgs.nodejs
pkgs.python3
pkgs.systemd
(
pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-std"];
targets = ["wasm32-unknown-unknown"];
}
)
];
}