From 93299efc7c587194de4c88ddcba5d33df3b51bf6 Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Tue, 25 Jan 2022 03:39:18 -0500 Subject: bundler: add tests and change defaults to use a derivation --- tests/flake-bundler.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/flake-bundler.sh (limited to 'tests/flake-bundler.sh') diff --git a/tests/flake-bundler.sh b/tests/flake-bundler.sh new file mode 100644 index 000000000..2e52f999d --- /dev/null +++ b/tests/flake-bundler.sh @@ -0,0 +1,23 @@ +source common.sh + +clearStore +rm -rf $TEST_HOME/.cache $TEST_HOME/.config $TEST_HOME/.local + +cp ./simple.nix ./simple.builder.sh ./config.nix $TEST_HOME + +cd $TEST_HOME + +cat < flake.nix +{ + outputs = {self}: { + defaultBundler.$system = drv: drv; + defaultPackage.$system = import ./simple.nix; + }; +} +EOF +nix build .# +nix bundle --bundler .# .# +nix bundle --bundler .#defaultBundler.$system .#defaultPackage.$system + +clearStore + -- cgit v1.2.3 From 4ebc50d92e65e7fd9cf30fb84a0c39a13475a31f Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Fri, 28 Jan 2022 09:56:58 -0500 Subject: bundler: revert default behavior to use defaultApp Bundlers are now responsible for correctly handling their inputs which are no longer constrained to be (Drv->Drv)->Drv->Drv, but can be of type (attrset->Drv)->attrset->Drv. --- tests/flake-bundler.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/flake-bundler.sh') diff --git a/tests/flake-bundler.sh b/tests/flake-bundler.sh index 2e52f999d..30e2fbd1d 100644 --- a/tests/flake-bundler.sh +++ b/tests/flake-bundler.sh @@ -10,8 +10,15 @@ cd $TEST_HOME cat < flake.nix { outputs = {self}: { - defaultBundler.$system = drv: drv; + defaultBundler.$system = drv: + if drv?type && drv.type == "derivation" + then drv + else self.defaultPackage.$system; defaultPackage.$system = import ./simple.nix; + defaultApp.$system = { + type = "app"; + program = "\${import ./simple.nix}/hello"; + }; }; } EOF -- cgit v1.2.3 From 73e82ae954be991858053df2a6b7323fe3a82c36 Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Fri, 28 Jan 2022 10:17:51 -0500 Subject: bundler: tests various combinations of referring to installables --- tests/flake-bundler.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/flake-bundler.sh') diff --git a/tests/flake-bundler.sh b/tests/flake-bundler.sh index 30e2fbd1d..699920f60 100644 --- a/tests/flake-bundler.sh +++ b/tests/flake-bundler.sh @@ -10,10 +10,11 @@ cd $TEST_HOME cat < flake.nix { outputs = {self}: { - defaultBundler.$system = drv: + bundlers.$system.simple = drv: if drv?type && drv.type == "derivation" then drv else self.defaultPackage.$system; + defaultBundler.$system = self.bundlers.$system.simple; defaultPackage.$system = import ./simple.nix; defaultApp.$system = { type = "app"; @@ -24,7 +25,11 @@ cat < flake.nix EOF nix build .# nix bundle --bundler .# .# -nix bundle --bundler .#defaultBundler.$system .#defaultPackage.$system +nix bundle --bundler .#defaultBundler.$system .#defaultPackage.$system +nix bundle --bundler .#bundlers.$system.simple .#defaultPackage.$system + +nix bundle --bundler .#defaultBundler.$system .#defaultApp.$system +nix bundle --bundler .#bundlers.$system.simple .#defaultApp.$system clearStore -- cgit v1.2.3 From 162fbe31ffe4c2b2d7648e5df2d5a0c9b4a44996 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 11 Feb 2022 18:11:08 +0100 Subject: Replace defaultBla.$system with bla.$system.default This also simplifies some InstallableFlake logic and fixes 'nix bundle' parsing its installable twice. Fixes #5532. --- tests/flake-bundler.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'tests/flake-bundler.sh') diff --git a/tests/flake-bundler.sh b/tests/flake-bundler.sh index 699920f60..9496b8f92 100644 --- a/tests/flake-bundler.sh +++ b/tests/flake-bundler.sh @@ -10,26 +10,28 @@ cd $TEST_HOME cat < flake.nix { outputs = {self}: { - bundlers.$system.simple = drv: + bundlers.$system = rec { + simple = drv: if drv?type && drv.type == "derivation" then drv - else self.defaultPackage.$system; - defaultBundler.$system = self.bundlers.$system.simple; - defaultPackage.$system = import ./simple.nix; - defaultApp.$system = { - type = "app"; - program = "\${import ./simple.nix}/hello"; - }; + else self.packages.$system.default; + default = simple; + }; + packages.$system.default = import ./simple.nix; + apps.$system.default = { + type = "app"; + program = "\${import ./simple.nix}/hello"; + }; }; } EOF nix build .# nix bundle --bundler .# .# -nix bundle --bundler .#defaultBundler.$system .#defaultPackage.$system -nix bundle --bundler .#bundlers.$system.simple .#defaultPackage.$system +nix bundle --bundler .#bundlers.$system.default .#packages.$system.default +nix bundle --bundler .#bundlers.$system.simple .#packages.$system.default -nix bundle --bundler .#defaultBundler.$system .#defaultApp.$system -nix bundle --bundler .#bundlers.$system.simple .#defaultApp.$system +nix bundle --bundler .#bundlers.$system.default .#apps.$system.default +nix bundle --bundler .#bundlers.$system.simple .#apps.$system.default clearStore -- cgit v1.2.3