#!/usr/bin/env bash source ../common.sh TODO_NixOS clearStore rm -rf "$TEST_HOME/.cache" "$TEST_HOME/.config" "$TEST_HOME/.local" # Create flake under test. cp ../shell-hello.nix "$config_nix" "$TEST_HOME/" cat <"$TEST_HOME/flake.nix" { inputs.nixpkgs.url = "$TEST_HOME/nixpkgs"; outputs = {self, nixpkgs}: { packages.$system.hello = (import ./config.nix).mkDerivation { name = "hello"; outputs = [ "out" "dev" ]; meta.outputsToInstall = [ "out" ]; buildCommand = ""; }; }; } EOF # Create fake nixpkgs flake. mkdir -p "$TEST_HOME/nixpkgs" cp "${config_nix}" ../shell.nix "$TEST_HOME/nixpkgs" # `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. removeBuildDirRef "$TEST_HOME/nixpkgs"/*.nix cat <"$TEST_HOME/nixpkgs/flake.nix" { outputs = {self}: { legacyPackages.$system.bashInteractive = (import ./shell.nix {}).bashInteractive; }; } EOF cd "$TEST_HOME" # Test whether `nix develop` passes through environment variables. [[ "$( ENVVAR=a nix develop --no-write-lock-file .#hello <