-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathflake.nix
More file actions
40 lines (39 loc) · 1.1 KB
/
flake.nix
File metadata and controls
40 lines (39 loc) · 1.1 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
ci = pkgs.writeShellScriptBin "ci" ''
set -euo pipefail
echo "--- test ---"
go test -v ./...
echo "--- lint ---"
golangci-lint run -E misspell,godot,whitespace ./...
echo "--- arrange ---"
command -v goarrange >/dev/null || go install github.com/jdeflander/goarrange@v1.0.0
test -z "$(goarrange run -r -d)"
echo "--- tidy ---"
go mod tidy
git diff --quiet go.mod go.sum
'';
in
{
default = pkgs.mkShell {
packages = [
pkgs.go_1_26
pkgs.golangci-lint
ci
];
};
}
);
};
}