dev/{go,rkt}: add extraShellHook with rkt functionality
This commit is contained in:
parent
2a7c73e748
commit
dcf4cdd88b
2 changed files with 51 additions and 11 deletions
|
@ -2,7 +2,9 @@
|
|||
pkgs ? import /home/steveej/src/github/NixOS/nixpkgs {},
|
||||
name ? "generic",
|
||||
version,
|
||||
extraBuildInputs ? [] }:
|
||||
extraBuildInputs ? [],
|
||||
extraShellHook ? ""
|
||||
}:
|
||||
let
|
||||
go = builtins.getAttr "go_${version}" pkgs;
|
||||
buildInputs = with pkgs; [
|
||||
|
@ -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}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue