From d69048e92be87158409a594a525388dd6950806a Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 18 Feb 2026 15:33:44 +0100 Subject: [PATCH] testing: migrate flakes/develop.sh Change-Id: Ibd97c54efb72285a4b969fe11e6e6adf3a2d5511 --- tests/functional/flakes/develop.sh | 71 ------------ tests/functional/meson.build | 1 - tests/functional2/flakes/test_develop.py | 109 ++++++++++++++++++ .../testlib/global_assets/shell.nix | 94 +++++++++++++++ 4 files changed, 203 insertions(+), 72 deletions(-) delete mode 100644 tests/functional/flakes/develop.sh create mode 100644 tests/functional2/flakes/test_develop.py create mode 100644 tests/functional2/testlib/global_assets/shell.nix diff --git a/tests/functional/flakes/develop.sh b/tests/functional/flakes/develop.sh deleted file mode 100644 index 81b3e6b78..000000000 --- a/tests/functional/flakes/develop.sh +++ /dev/null @@ -1,71 +0,0 @@ -source ../common.sh - -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 ../nix-shell/shell.nix $TEST_HOME/nixpkgs -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 <> $out/bin/foo + echo 'echo ${fooContents}' >> $out/bin/foo + chmod a+rx $out/bin/foo + ln -s ${shell} $out/bin/bash + ''; + + bar = runCommand "bar" {} '' + mkdir -p $out/bin + echo '#!${shell}' > $out/bin/bar + echo 'echo bar' >> $out/bin/bar + chmod a+rx $out/bin/bar + ''; + + bash = shell; + bashInteractive = runCommand "bash" {} '' + mkdir -p $out/bin + ln -s ${shell} $out/bin/bash + ''; + + # ruby "interpreter" that outputs "$@" + ruby = runCommand "ruby" {} '' + mkdir -p $out/bin + echo '#!${shell}' > $out/bin/ruby + echo 'printf %s "$*"' >> $out/bin/ruby + chmod a+rx $out/bin/ruby + ''; + + inherit pkgs; +}; in pkgs