-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgolang.nix
71 lines (62 loc) · 1.68 KB
/
golang.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
{ flake-utils, gitignore, devshell, gomod2nix}: { nixpkgs, dir, name, version, package-overlay}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs
{
inherit system;
overlays = [ gomod2nix.overlays.default devshell.overlays.default ];
};
in
rec {
devShells.default = pkgs.devshell.mkShell
{
commands = [
{
name = "update-gomod2nix";
help = "update gomod2nix.toml";
command = "gomod2nix";
}
];
packages = with pkgs; [
go_1_21
gotools
golangci-lint
gopls
gopkgs
go-outline
go-bindata
gomod2nix.packages.${system}.default
(clojure.override { jdk = temurin-bin; })
clojure-lsp
temurin-bin
];
};
packages = package-overlay pkgs rec {
app = pkgs.buildGoApplication {
pname = name;
version = version;
src = dir;
go = pkgs.go_1_21;
pwd = dir;
CGO_ENABLED = 0;
modules = (dir + /gomod2nix.toml);
};
docker = pkgs.dockerTools.buildImage {
name = "docker-pod";
tag = "latest";
config = {
Cmd = [ "${app}/bin/${name}" ];
};
};
# next two packages are only for testing an arm build running on an amd host
default-linux = app.overrideAttrs (old: old // { GOOS = "linux"; GOARCH = "arm64"; });
docker-arm64 = pkgs.dockerTools.buildImage {
name = "docker-pod";
tag = "latest";
config = {
Cmd = [ "${default-linux}/bin/linux_arm64/${name}" ];
};
};
};
}
)