Skip to content

Instantly share code, notes, and snippets.

@stevenanthonyrevo
Last active March 31, 2024 02:48
Show Gist options
  • Select an option

  • Save stevenanthonyrevo/3164d60037fb18bd5c71de563e9ea3fc to your computer and use it in GitHub Desktop.

Select an option

Save stevenanthonyrevo/3164d60037fb18bd5c71de563e9ea3fc to your computer and use it in GitHub Desktop.
NixOS - Go - Create a Hello World Program. No Docker required.
package main
import "fmt"
func main() {
fmt.Printf("%s\n", "hello world")
}
#!/bin/bash
nix-shell --arg pkgs '(import <nixpkgs> {})' --run "true"
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShellNoCC {
packages = with pkgs; [
go
];
shellHook = ''
go version
go build -o helloworld main.go
echo 'done'
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment