hello-go: init

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