tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
hello-go: init
aleksana
1 year ago
34d6dfa3
51d4a931
+54
3 changed files
expand all
collapse all
unified
split
pkgs
by-name
he
hello-go
package.nix
src
go.mod
main.go
+44
pkgs/by-name/he/hello-go/package.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
buildGoModule,
4
4
+
}:
5
5
+
6
6
+
buildGoModule {
7
7
+
name = "hello-go";
8
8
+
9
9
+
src = ./src;
10
10
+
11
11
+
vendorHash = null;
12
12
+
13
13
+
CGO_ENABLED = 0;
14
14
+
15
15
+
# go installs binary into $out/bin/$GOOS_$GOARCH/hello-go in cross compilation
16
16
+
postInstall = ''
17
17
+
[[ -f "$out/bin/hello-go" ]] || ln -s ./''${GOOS}_''${GOARCH}/hello-go $out/bin/hello-go
18
18
+
'';
19
19
+
20
20
+
meta = {
21
21
+
description = "Simple program printing hello world in Go";
22
22
+
longDescription = ''
23
23
+
hello-go is a simple program printing "Hello, world!" written in Go,
24
24
+
aiming at testing programs that involves analyzing executables or
25
25
+
emulating foreign architectures, without pulling in a heavy cross
26
26
+
toolchain.
27
27
+
28
28
+
Specify target platform by setting GOOS and GOARCH:
29
29
+
30
30
+
```nix
31
31
+
hello-go.overrideAttrs {
32
32
+
GOOS = "linux";
33
33
+
GOARCH = "arm64";
34
34
+
}
35
35
+
```
36
36
+
37
37
+
See https://pkg.go.dev/internal/platform#pkg-variables for a list
38
38
+
of available platforms.
39
39
+
'';
40
40
+
license = lib.licenses.mit;
41
41
+
maintainers = with lib.maintainers; [ aleksana ];
42
42
+
mainProgram = "hello-go";
43
43
+
};
44
44
+
}
+3
pkgs/by-name/he/hello-go/src/go.mod
···
1
1
+
module hello-go
2
2
+
3
3
+
go 1.22.7
+7
pkgs/by-name/he/hello-go/src/main.go
···
1
1
+
package main
2
2
+
3
3
+
import "fmt"
4
4
+
5
5
+
func main() {
6
6
+
fmt.Println("Hello, world!")
7
7
+
}