summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-10-21 14:43:55 +0200
committerlassulus <lassulus@lassul.us>2022-10-23 11:34:39 +0200
commit8666475b74ecd15bcf546f554c0587f496cd9c8f (patch)
tree9298c60e650ad305aa15eee82ca392b6d73bc839 /tests
parentc96ccd7d9fb48b8283e84811c2355a3c39bb2a52 (diff)
tests: pass lib to examples
Diffstat (limited to 'tests')
-rw-r--r--tests/lib.nix8
-rw-r--r--tests/with-lib.nix11
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/lib.nix b/tests/lib.nix
index fb9d1e9..b3b3009 100644
--- a/tests/lib.nix
+++ b/tests/lib.nix
@@ -21,10 +21,10 @@
inherit (pkgs) system;
};
disks = [ "/dev/vda" "/dev/vdb" "/dev/vdc" "/dev/vdd" "/dev/vde" "/dev/vdf" ];
- tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. { }).create (disko-config { disks = builtins.tail disks; }));
- tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. { }).mount (disko-config { disks = builtins.tail disks; }));
- tsp-config = (pkgs.callPackage ../. { }).config (disko-config { inherit disks; });
- num-disks = builtins.length (lib.attrNames (disko-config {}).disk);
+ tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. { }).create (disko-config { disks = builtins.tail disks; inherit lib; }));
+ tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. { }).mount (disko-config { disks = builtins.tail disks; inherit lib; }));
+ tsp-config = (pkgs.callPackage ../. { }).config (disko-config { inherit disks; inherit lib; });
+ num-disks = builtins.length (lib.attrNames (disko-config { inherit lib; }).disk);
installed-system = { modulesPath, ... }: {
imports = [
tsp-config
diff --git a/tests/with-lib.nix b/tests/with-lib.nix
new file mode 100644
index 0000000..e94cf00
--- /dev/null
+++ b/tests/with-lib.nix
@@ -0,0 +1,11 @@
+{ pkgs ? (import <nixpkgs> { })
+, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
+}:
+makeDiskoTest {
+ disko-config = import ../example/with-lib.nix;
+ extraTestScript = ''
+ machine.succeed("mountpoint /");
+ '';
+ efi = false;
+ grub-devices = [ "/dev/vdb" ];
+}