From 3e0b4ddd3baff081cb29497e3bc3a869c8e8036c Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Thu, 2 Feb 2023 21:16:11 +0200 Subject: [PATCH] {example,tests}: add hybrid-tmpfs-on-root --- example/hybrid-tmpfs-on-root.nix | 52 ++++++++++++++++++++++++++++++++ tests/hybrid-tmpfs-on-root.nix | 10 ++++++ 2 files changed, 62 insertions(+) create mode 100644 example/hybrid-tmpfs-on-root.nix create mode 100644 tests/hybrid-tmpfs-on-root.nix diff --git a/example/hybrid-tmpfs-on-root.nix b/example/hybrid-tmpfs-on-root.nix new file mode 100644 index 0000000..4f48101 --- /dev/null +++ b/example/hybrid-tmpfs-on-root.nix @@ -0,0 +1,52 @@ +{ disks ? [ "/dev/sda" ], ... }: +{ + disk.main = { + device = builtins.elemAt disks 0; + type = "disk"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + name = "boot"; + type = "partition"; + start = "0"; + end = "1M"; + flags = [ "bios_grub" ]; + } + { + type = "partition"; + name = "ESP"; + start = "1M"; + end = "512M"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + name = "nix"; + type = "partition"; + start = "512M"; + end = "100%"; + part-type = "primary"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/nix"; + }; + } + ]; + }; + }; + nodev."/" = { + fsType = "tmpfs"; + mountOptions = [ + "size=2G" + "defaults" + "mode=755" + ]; + }; +} diff --git a/tests/hybrid-tmpfs-on-root.nix b/tests/hybrid-tmpfs-on-root.nix new file mode 100644 index 0000000..0e6af1d --- /dev/null +++ b/tests/hybrid-tmpfs-on-root.nix @@ -0,0 +1,10 @@ +{ pkgs ? (import { }) +, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest +}: +makeDiskoTest { + disko-config = ../example/hybrid-tmpfs-on-root.nix; + extraTestScript = '' + machine.succeed("mountpoint /"); + machine.succeed("findmnt / --types tmpfs"); + ''; +}