summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--example/config-gpt-bios.nix33
-rw-r--r--example/gpt-bios-compat.nix37
-rw-r--r--tests/gpt-bios-compat.nix10
3 files changed, 47 insertions, 33 deletions
diff --git a/example/config-gpt-bios.nix b/example/config-gpt-bios.nix
deleted file mode 100644
index 9dfcffa..0000000
--- a/example/config-gpt-bios.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-# Example to create a bios compatible gpt partition
-{
- type = "devices";
- content = {
- sda = {
- type = "table";
- format = "gpt";
- partitions = [
- {
- type = "partition";
- start = "0";
- end = "1M";
- part-type = "primary";
- flags = ["bios_grub"];
- content.type = "noop";
- }
- {
- type = "partition";
- # leave space for the grub aka BIOS boot
- start = "1M";
- end = "100%";
- part-type = "primary";
- bootable = true;
- content = {
- type = "filesystem";
- format = "ext4";
- mountpoint = "/";
- };
- }
- ];
- };
- };
-}
diff --git a/example/gpt-bios-compat.nix b/example/gpt-bios-compat.nix
new file mode 100644
index 0000000..9abe691
--- /dev/null
+++ b/example/gpt-bios-compat.nix
@@ -0,0 +1,37 @@
+# Example to create a bios compatible gpt partition
+{
+ disk = {
+ vdb = {
+ device = "/dev/vdb";
+ type = "disk";
+ content = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ name = "boot";
+ type = "partition";
+ start = "0";
+ end = "1M";
+ part-type = "primary";
+ flags = ["bios_grub"];
+ }
+ {
+ name = "root";
+ type = "partition";
+ # leave space for the grub aka BIOS boot
+ start = "1M";
+ end = "100%";
+ part-type = "primary";
+ bootable = true;
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/";
+ };
+ }
+ ];
+ };
+ };
+ };
+}
diff --git a/tests/gpt-bios-compat.nix b/tests/gpt-bios-compat.nix
new file mode 100644
index 0000000..df35335
--- /dev/null
+++ b/tests/gpt-bios-compat.nix
@@ -0,0 +1,10 @@
+{ pkgs ? (import <nixpkgs> { })
+, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
+}:
+makeDiskoTest {
+ disko-config = import ../example/gpt-bios-compat.nix;
+ extraTestScript = ''
+ machine.succeed("mountpoint /mnt");
+ machine.succeed("grub-install --target=i386-pc /dev/vdb");
+ '';
+}