diff --git a/derivations/dev/go.nix b/derivations/dev/go.nix index 3bb8af8..620f5d3 100644 --- a/derivations/dev/go.nix +++ b/derivations/dev/go.nix @@ -2,8 +2,10 @@ pkgs ? import /home/steveej/src/github/NixOS/nixpkgs {}, name ? "generic", version, -extraBuildInputs ? [] }: -let +extraBuildInputs ? [], +extraShellHook ? "" +}: +let go = builtins.getAttr "go_${version}" pkgs; buildInputs = with pkgs; [ glibc.out @@ -21,16 +23,27 @@ let #ginkgo ginkgo.bin #gomega ]; - goShellHook = { go, name }: '' - goname=${go.version}_$name - setPS1 $goname - export GOROOT=${go}/share/go - export GOPATH="$HOME/.gopath_$goname" - export PATH="$HOME/.gopath_$goname/bin:$PATH" - unset name - ''; + in pkgs.stdenv.mkDerivation { inherit name; - shellHook = (goShellHook) { inherit name; inherit go; }; buildInputs = extraBuildInputs ++ buildInputs; + shellHook = '' + goname=${go.version}_$name + setPS1 $goname + export GOROOT=${go}/share/go + export GOPATH="$HOME/.gopath_$goname" + export PATH="$HOME/.gopath_$goname/bin:$PATH" + unset name + unset SSL_CERT_FILE + + go get -u github.com/Masterminds/glide + go get -u github.com/sgotti/glide-vc + go get -u github.com/alecthomas/gometalinter + go get -u github.com/golang/lint/golint + go get -u github.com/rogpeppe/godef + go get -u github.com/kisielk/errcheck + go get -u github.com/jstemmer/gotags + go get -u github.com/klauspost/asmfmt/cmd/asmfmt + ${extraShellHook} + ''; } diff --git a/derivations/dev/rkt.nix b/derivations/dev/rkt.nix index dac0a1c..072018c 100644 --- a/derivations/dev/rkt.nix +++ b/derivations/dev/rkt.nix @@ -1,6 +1,7 @@ { pkgs ? import /home/steveej/src/github/NixOS/nixpkgs {}, mkGoEnv ? import ./go.nix, +rktPath, }: let rktBasebuildInputs = with pkgs; [ @@ -26,6 +27,21 @@ let trousers systemd ]; + extraShellHook = '' + TARGET=$GOPATH/src/github.com/coreos/rkt + if [[ -e ${rktPath}/rkt/rkt.go ]]; then + pushd ${rktPath} + else + echo rktPath must be run the rkt repository clone, but got '${rktPath}' + exit 1 + fi + if ! [[ -e $TARGET/rkt/rkt.go ]]; then + mkdir -p $TARGET + echo $PWD + sudo -E mount -o bind $PWD $TARGET + fi + pushd $TARGET + ''; in { go15 = mkGoEnv { inherit pkgs; @@ -33,6 +49,7 @@ in { name = "rktGo15"; version = "1_5"; extraBuildInputs = rktBasebuildInputs; + inherit extraShellHook; }; go16 = mkGoEnv { @@ -41,5 +58,15 @@ in { name = "rktGo16"; version = "1_6"; extraBuildInputs = rktBasebuildInputs; + inherit extraShellHook; + }; + + go17 = mkGoEnv { + inherit pkgs; + + name = "rktGo17"; + version = "1_7"; + extraBuildInputs = rktBasebuildInputs; + inherit extraShellHook; }; }