From ca97497bfdd7adf39759f785845d60cefc165027 Mon Sep 17 00:00:00 2001 From: Hariom Narang Date: Tue, 21 Nov 2023 01:11:06 +0530 Subject: [PATCH] made EXPR_PATH point to local instead of store - we need this behavior in dev shell - the main build still uses the store file --- pkgs/test/nixpkgs-check-by-name/default.nix | 6 +++--- pkgs/test/nixpkgs-check-by-name/src/eval.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/test/nixpkgs-check-by-name/default.nix b/pkgs/test/nixpkgs-check-by-name/default.nix index 3469319c29c1..fc24b1fd3398 100644 --- a/pkgs/test/nixpkgs-check-by-name/default.nix +++ b/pkgs/test/nixpkgs-check-by-name/default.nix @@ -8,7 +8,7 @@ makeWrapper, }: let - runtimeExprPath = "${./src/eval.nix}"; + runtimeExprPath = ./src/eval.nix; package = rustPlatform.buildRustPackage { name = "nixpkgs-check-by-name"; @@ -20,7 +20,7 @@ let clippy makeWrapper ]; - env.NIX_CHECK_BY_NAME_EXPR_PATH = runtimeExprPath; + env.NIX_CHECK_BY_NAME_EXPR_PATH = "${runtimeExprPath}"; # Needed to make Nix evaluation work inside the nix build preCheck = '' export TEST_ROOT=$(pwd)/test-tmp @@ -43,7 +43,7 @@ let --set NIX_CHECK_BY_NAME_EXPR_PATH "$NIX_CHECK_BY_NAME_EXPR_PATH" ''; passthru.shell = mkShell { - env.NIX_CHECK_BY_NAME_EXPR_PATH = runtimeExprPath; + env.NIX_CHECK_BY_NAME_EXPR_PATH = toString runtimeExprPath; inputsFrom = [ package ]; }; }; diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.rs b/pkgs/test/nixpkgs-check-by-name/src/eval.rs index e8ef50bb6db7..161d013374e7 100644 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.rs +++ b/pkgs/test/nixpkgs-check-by-name/src/eval.rs @@ -58,7 +58,8 @@ pub fn check_values( attrs_file_path.display() ))?; - let expr_path = std::env::var("NIX_CHECK_BY_NAME_EXPR_PATH")?; + let expr_path = std::env::var("NIX_CHECK_BY_NAME_EXPR_PATH") + .context("Could not get environment variable NIX_CHECK_BY_NAME_EXPR_PATH")?; // With restrict-eval, only paths in NIX_PATH can be accessed, so we explicitly specify the // ones needed needed let mut command = process::Command::new("nix-instantiate");