From bca2a1231e181444e79c4c9022aad7c1ad747f63 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 23 Aug 2022 21:08:56 +0800 Subject: [PATCH] Fix Go compiler missing from mkGoEnv created environments Closes #68 --- builder/default.nix | 2 +- shell.nix | 6 +++--- tests/mkgoenv/default.nix | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 8b8ae19..e499596 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -170,7 +170,7 @@ let dontConfigure = true; dontInstall = true; - propagatedNativeBuildInputs = [ go ]; + propagatedBuildInputs = [ go ]; GO_NO_VENDOR_CHECKS = "1"; diff --git a/shell.nix b/shell.nix index a33b65d..f80d988 100644 --- a/shell.nix +++ b/shell.nix @@ -12,10 +12,10 @@ pkgs.mkShell { NIX_PATH = "nixpkgs=${builtins.toString pkgs.path}"; - buildInputs = [ + nativeBuildInputs = [ pkgs.nixpkgs-fmt - pkgs.gomod2nix.go - pkgs.gomod2nix pkgs.golangci-lint + pkgs.gomod2nix + (pkgs.mkGoEnv { pwd = ./.; }) ]; } diff --git a/tests/mkgoenv/default.nix b/tests/mkgoenv/default.nix index bc566ac..385fb23 100644 --- a/tests/mkgoenv/default.nix +++ b/tests/mkgoenv/default.nix @@ -1,15 +1,21 @@ -{ runCommand, mkGoEnv }: +{ runCommand, mkGoEnv, which }: let env = mkGoEnv { pwd = ./.; }; in -runCommand "mkgoenv-assert" { } '' +runCommand "mkgoenv-assert" +{ + nativeBuildInputs = [ which ]; + buildInputs = [ env ]; # Trigger propagation +} '' if ! test -f ${env}/bin/stringer; then echo "stringer command not found in env!" exit 1 fi + which go > /dev/null || echo "Go compiler not found in env!" + ln -s ${env} $out ''