forked from tiiuae/ghaf-givc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devshell.nix
77 lines (76 loc) · 2.12 KB
/
devshell.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
{ inputs, ... }:
{
imports = [
inputs.devshell.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
];
perSystem =
{ pkgs, config, ... }:
{
devshells.default = {
devshell = {
name = "GIVC";
motd = ''
{14}{bold}❄️ Welcome to the givc devshell ❄️{reset}
$(type -p menu &>/dev/null && menu)
$(type -p update-pre-commit-hooks &>/dev/null && update-pre-commit-hooks)
'';
};
packages = with pkgs; [
config.treefmt.build.wrapper
reuse
go
gopls
gosec
gotests
go-tools
golangci-lint
rustc
rustfmt
cargo
pkgs.stdenv.cc # Need for build rust components
protobuf
protoc-gen-go
protoc-gen-go-grpc
grpcurl
];
commands = [
{
name = "update-pre-commit-hooks";
command = config.pre-commit.installationScript;
category = "tools";
help = "update git pre-commit hooks";
}
{
help = "Generate go files from protobuffers. Examples: '$ protogen systemd'";
name = "protogen";
command = "./api/protoc.sh $@";
}
{
help = "Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers";
name = "gcl";
command = "grpcurl";
}
{
help = "Check golang vulnerabilities";
name = "go-checksec";
command = "gosec ./...";
}
{
help = "Update go dependencies";
name = "go-update";
command = "go get -u ./... && go mod tidy && echo Done - do not forget to update the vendorHash in the packages.";
}
{
help = "golang linter";
package = "golangci-lint";
category = "linters";
}
];
};
pre-commit.settings = {
hooks.treefmt.enable = true;
hooks.treefmt.package = config.treefmt.build.wrapper;
};
};
}