Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
125 lines (111 loc) · 3.66 KB
/
Copy pathflake.nix
File metadata and controls
125 lines (111 loc) · 3.66 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
description = "go-github-kit — operational kernel over google/go-github: auth, rate limiting, retry, ETag cache";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
# Inline systems: nixpkgs 26.11 dropped x86_64-darwin, which github:nix-systems/default still lists.
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
imports = [ inputs.treefmt-nix.flakeModule ];
perSystem =
{
config,
pkgs,
lib,
...
}:
let
goPkg = pkgs.go_1_27;
in
{
devShells.default = pkgs.mkShellNoCC {
packages = builtins.attrValues {
inherit (pkgs)
go_1_27
golangci-lint
govulncheck
golines
nixfmt
actionlint
;
};
GOTOOLCHAIN = "local";
GOEXPERIMENT = "jsonv2";
};
packages.default = (pkgs.buildGoModule.override { go = pkgs.go_1_27; }) {
pname = "go-github-kit";
version = self.rev or self.dirtyRev or "dev";
src = ./.;
# go.mod carries a go 1.27.1 floor (copied from go-etag v0.6.0).
# The toolchain is overridden at callPackage level: a plain
# `go = …` attr is silently ignored by buildGoModule (the FOD
# and the build then run the default go and trip the floor).
vendorHash = "sha256-NNGJcMY3DJUvBzAvZXunpKmiLVsLNlm2Hkw7xc2m51A=";
meta = with lib; {
description = "Operational kernel over google/go-github: auth, rate limiting, retry, ETag cache";
homepage = "https://github.com/LarsArtmann/go-github-kit";
license = licenses.mit;
platforms = platforms.unix;
};
env.CGO_ENABLED = "0";
env.GOWORK = "off";
doCheck = false;
};
apps = {
test = {
type = "app";
meta.description = "Run the Go test suite with the race detector";
program = "${
pkgs.writeShellApplication {
name = "test";
runtimeInputs = [ goPkg ];
text = ''
export CGO_ENABLED=0 GOTOOLCHAIN=local GOEXPERIMENT=jsonv2
exec go test -race "$@" ./...
'';
}
}/bin/test";
};
lint = {
type = "app";
meta.description = "Run golangci-lint";
program = "${
pkgs.writeShellApplication {
name = "lint";
runtimeInputs = [
goPkg
pkgs.golangci-lint
];
text = ''
export GOTOOLCHAIN=local GOEXPERIMENT=jsonv2
exec golangci-lint run ./...
'';
}
}/bin/lint";
};
};
treefmt = {
programs = {
nixfmt.enable = true;
gofmt.enable = true;
};
};
checks.build = config.packages.default;
checks.format = config.treefmt.build.check self;
};
};
}