Fix Go compiler missing from mkGoEnv created environments

Closes #68
This commit is contained in:
adisbladis 2022-08-23 21:08:56 +08:00
parent b8c2216317
commit bca2a1231e
3 changed files with 12 additions and 6 deletions

View file

@ -170,7 +170,7 @@ let
dontConfigure = true; dontConfigure = true;
dontInstall = true; dontInstall = true;
propagatedNativeBuildInputs = [ go ]; propagatedBuildInputs = [ go ];
GO_NO_VENDOR_CHECKS = "1"; GO_NO_VENDOR_CHECKS = "1";

View file

@ -12,10 +12,10 @@
pkgs.mkShell { pkgs.mkShell {
NIX_PATH = "nixpkgs=${builtins.toString pkgs.path}"; NIX_PATH = "nixpkgs=${builtins.toString pkgs.path}";
buildInputs = [ nativeBuildInputs = [
pkgs.nixpkgs-fmt pkgs.nixpkgs-fmt
pkgs.gomod2nix.go
pkgs.gomod2nix
pkgs.golangci-lint pkgs.golangci-lint
pkgs.gomod2nix
(pkgs.mkGoEnv { pwd = ./.; })
]; ];
} }

View file

@ -1,15 +1,21 @@
{ runCommand, mkGoEnv }: { runCommand, mkGoEnv, which }:
let let
env = mkGoEnv { env = mkGoEnv {
pwd = ./.; pwd = ./.;
}; };
in in
runCommand "mkgoenv-assert" { } '' runCommand "mkgoenv-assert"
{
nativeBuildInputs = [ which ];
buildInputs = [ env ]; # Trigger propagation
} ''
if ! test -f ${env}/bin/stringer; then if ! test -f ${env}/bin/stringer; then
echo "stringer command not found in env!" echo "stringer command not found in env!"
exit 1 exit 1
fi fi
which go > /dev/null || echo "Go compiler not found in env!"
ln -s ${env} $out ln -s ${env} $out
'' ''