diff options
author | lassulus <lassulus@lassul.us> | 2022-10-21 14:43:55 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-10-23 11:34:39 +0200 |
commit | 8666475b74ecd15bcf546f554c0587f496cd9c8f (patch) | |
tree | 9298c60e650ad305aa15eee82ca392b6d73bc839 /example/with-lib.nix | |
parent | c96ccd7d9fb48b8283e84811c2355a3c39bb2a52 (diff) |
tests: pass lib to examples
Diffstat (limited to 'example/with-lib.nix')
-rw-r--r-- | example/with-lib.nix | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/example/with-lib.nix b/example/with-lib.nix new file mode 100644 index 0000000..e746f5b --- /dev/null +++ b/example/with-lib.nix @@ -0,0 +1,35 @@ +# Example to create a bios compatible gpt partition +{ disks ? [ "/dev/vdb" ], lib, ... }: { + disk = lib.traceValSeq (lib.genAttrs [ (lib.head disks) ] (device: { + device = device; + 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 = "/"; + }; + } + ]; + }; + })); +} |