diff --git a/flake.nix b/flake.nix index 8eb3b98619f6d..631488a20694d 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,11 @@ test = { type = "app"; - program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = true; })}/bin/loki --version"; + program = with pkgs; "${ + (writeShellScriptBin "test.sh" '' + ${loki.overrideAttrs(old: { doCheck = true; })}/bin/loki --version + '') + }/bin/test.sh"; }; loki = { diff --git a/nix/packages/loki.nix b/nix/packages/loki.nix index 62bf812015ee6..b083db6e4a7d4 100644 --- a/nix/packages/loki.nix +++ b/nix/packages/loki.nix @@ -1,4 +1,21 @@ { pkgs, version, imageTag }: +let + lambda-promtail-gomod = pkgs.buildGoModule { + inherit version; + pname = "lambda-promtail"; + + src = ./../../tools/lambda-promtail; + vendorSha256 = "11yNeQb4k5/w0+r+LJOmjXUQRaWvWSXqM+zMHtMVxY8="; + + doCheck = false; + + installPhase = '' + runHook preInstall + cp -r --reflink=auto vendor $out + runHook postInstall + ''; + }; +in pkgs.stdenv.mkDerivation { inherit version; @@ -37,6 +54,9 @@ pkgs.stdenv.mkDerivation { buildPhase = '' export GOCACHE=$TMPDIR/go-cache export GOMODCACHE=$TMPDIR/gomodcache + export GOPROXY=off + + cp -r ${lambda-promtail-gomod} tools/lambda-promtail/vendor make clean loki ''; @@ -45,6 +65,8 @@ pkgs.stdenv.mkDerivation { export GOCACHE=$TMPDIR/go-cache export GOMODCACHE=$TMPDIR/gomodcache export GOLANGCI_LINT_CACHE=$TMPDIR/go-cache + export GOPROXY=off + make lint test '';