summaryrefslogtreecommitdiff
path: root/bin/go-playground
blob: b1b96617e45003b583a8e42949ca7e30fc6c04d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

set -e -x

cd "$(mktemp -d)"

cat >main.go <<EOF
package main

import (
	"fmt"
)

func main() {
	fmt.Println("aloha")
}
EOF

cat >shell.nix <<EOF
let
    pkgsVersion = "22.11";
    pkgsSrc = fetchTarball {
      name = "nixpkgs-\${pkgsVersion}";
      url = "https://github.com/NixOS/nixpkgs/archive/ce20e9ebe1903ea2ba1ab006ec63093020c761cb.tar.gz";
      sha256 = "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=";
    };
    pkgs = (import pkgsSrc) {};
in
    pkgs.mkShell {
        buildInputs = [
            pkgs.go
            pkgs.golangci-lint
        ];

        shellHook = ''
            go mod init local-playground
            $EDITOR main.go
        '';
    }
EOF

nix-shell -v