hello-go: init (#344180)
This commit is contained in:
commit
668c45925f
44
pkgs/by-name/he/hello-go/package.nix
Normal file
44
pkgs/by-name/he/hello-go/package.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
}:
|
||||
|
||||
buildGoModule {
|
||||
name = "hello-go";
|
||||
|
||||
src = ./src;
|
||||
|
||||
vendorHash = null;
|
||||
|
||||
CGO_ENABLED = 0;
|
||||
|
||||
# go installs binary into $out/bin/$GOOS_$GOARCH/hello-go in cross compilation
|
||||
postInstall = ''
|
||||
[[ -f "$out/bin/hello-go" ]] || ln -s ./''${GOOS}_''${GOARCH}/hello-go $out/bin/hello-go
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Simple program printing hello world in Go";
|
||||
longDescription = ''
|
||||
hello-go is a simple program printing "Hello, world!" written in Go,
|
||||
aiming at testing programs that involves analyzing executables or
|
||||
emulating foreign architectures, without pulling in a heavy cross
|
||||
toolchain.
|
||||
|
||||
Specify target platform by setting GOOS and GOARCH:
|
||||
|
||||
```nix
|
||||
hello-go.overrideAttrs {
|
||||
GOOS = "linux";
|
||||
GOARCH = "arm64";
|
||||
}
|
||||
```
|
||||
|
||||
See https://pkg.go.dev/internal/platform#pkg-variables for a list
|
||||
of available platforms.
|
||||
'';
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ aleksana ];
|
||||
mainProgram = "hello-go";
|
||||
};
|
||||
}
|
3
pkgs/by-name/he/hello-go/src/go.mod
Normal file
3
pkgs/by-name/he/hello-go/src/go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module hello-go
|
||||
|
||||
go 1.22.7
|
7
pkgs/by-name/he/hello-go/src/main.go
Normal file
7
pkgs/by-name/he/hello-go/src/main.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, world!")
|
||||
}
|
Loading…
Reference in New Issue
Block a user