testing: migrate flakes/bundle.sh
Change-Id: I734b52da3c62d6f562d6c843b89cb55ba6bd70d2
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
source common.sh
|
||||
|
||||
cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME
|
||||
|
||||
cd $TEST_HOME
|
||||
|
||||
cat <<EOF > flake.nix
|
||||
{
|
||||
outputs = {self}: {
|
||||
bundlers.$system = rec {
|
||||
simple = drv:
|
||||
if drv?type && drv.type == "derivation"
|
||||
then drv
|
||||
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 .#bundlers.$system.default .#packages.$system.default
|
||||
nix bundle --bundler .#bundlers.$system.simple .#packages.$system.default
|
||||
|
||||
nix bundle --bundler .#bundlers.$system.default .#apps.$system.default
|
||||
nix bundle --bundler .#bundlers.$system.simple .#apps.$system.default
|
||||
@@ -39,7 +39,6 @@ functional_tests_scripts = [
|
||||
'flakes/init.sh',
|
||||
'flakes/inputs.sh',
|
||||
'flakes/follow-paths.sh',
|
||||
'flakes/bundle.sh',
|
||||
'flakes/build-paths.sh',
|
||||
'flakes/flake-in-submodule.sh',
|
||||
'flakes/flake-metadata.sh',
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
from testlib.fixtures.nix import Nix
|
||||
from testlib.fixtures.file_helper import with_files, File
|
||||
from testlib.environ import environ
|
||||
from testlib.utils import get_global_asset_pack
|
||||
import pytest
|
||||
|
||||
system = environ.get("system")
|
||||
|
||||
files = get_global_asset_pack("simple-drv") | {
|
||||
"flake.nix": File(f"""{{
|
||||
outputs = {{self}}: {{
|
||||
bundlers.{system} = rec {{
|
||||
simple = drv:
|
||||
if drv?type && drv.type == "derivation"
|
||||
then drv
|
||||
else self.packages.{system}.default;
|
||||
default = simple;
|
||||
}};
|
||||
packages.{system}.default = import ./simple.nix;
|
||||
apps.{system}.default = {{
|
||||
type = "app";
|
||||
program = "${{import ./simple.nix}}/hello";
|
||||
}};
|
||||
}};
|
||||
}}""")
|
||||
}
|
||||
|
||||
|
||||
@with_files(files)
|
||||
@pytest.mark.parametrize(
|
||||
("bundler", "attr"),
|
||||
[
|
||||
(".#", ".#"),
|
||||
(f".#bundlers.{system}.default", f".#packages.{system}.default"),
|
||||
(f".#bundlers.{system}.simple", f".#packages.{system}.default"),
|
||||
(f".#bundlers.{system}.default", f".#apps.{system}.default"),
|
||||
(f".#bundlers.{system}.simple", f".#apps.{system}.default"),
|
||||
],
|
||||
)
|
||||
def test_bundle(nix: Nix, bundler: str, attr: str):
|
||||
nix.settings.add_xp_feature("nix-command", "flakes")
|
||||
nix.nix(["build", ".#"]).run().ok()
|
||||
nix.nix(["bundle", "--bundler", bundler, attr]).run().ok()
|
||||
Reference in New Issue
Block a user