-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (81 loc) · 2.18 KB
/
flake.nix
File metadata and controls
96 lines (81 loc) · 2.18 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
description = "Githooks Dev";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# Format the repo with nix-treefmt.
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
flake-utils,
...
}@inputs:
flake-utils.lib.eachDefaultSystem
# Creates an attribute map `{ devShells.<system>.default = ...}`
# by calling this function:
(
system:
let
overlays = [ ];
# Import nixpkgs and load it into pkgs.
pkgs = import nixpkgs {
inherit system overlays;
};
# Configure formatter.
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "README.md";
# Markdown, JSON, YAML, etc.
programs.prettier.enable = true;
# Go
programs.gofmt.enable = true;
programs.goimports.enable = true;
programs.golines.enable = true;
# Shell.
programs.shfmt = {
enable = true;
indent_size = 4;
};
programs.shellcheck.enable = true;
# Nix.
programs.nixfmt.enable = true;
};
treefmt = treefmtEval.config.build.wrapper;
# Things needed only at compile-time.
packages = with pkgs; [
coreutils
findutils
gitFull
gnugrep
bash
jq
curl
just
go_1_24
golines
gotools
gopls
golangci-lint
golangci-lint-langserver
treefmt
];
in
with pkgs;
{
devShells.default = mkShell {
# To make CGO and the debugger delve work.
# https://nixos.wiki/wiki/Go#Using_cgo_on_NixOS
hardeningDisable = [ "fortify" ];
inherit packages;
};
devShells.format = mkShell {
inherit packages;
};
}
);
}