Last active
March 31, 2024 02:48
-
-
Save stevenanthonyrevo/3164d60037fb18bd5c71de563e9ea3fc to your computer and use it in GitHub Desktop.
NixOS - Go - Create a Hello World Program. No Docker required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| fmt.Printf("%s\n", "hello world") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| nix-shell --arg pkgs '(import <nixpkgs> {})' --run "true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { 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