Disks

The disks module can be used by importing inputs.self.nixosModules.malobeo.disko

let cfg = malobeo.disks

cfg.enable (bool)

  • Type: bool
  • Default: false
  • Description:
    Enables the disk creation process using the disko tool. Set to true to initialize disk setup.

cfg.hostId (string)

  • Type: string
  • Default: ""
  • Description:
    The host ID used for ZFS disks. This ID should be generated using a command like head -c4 /dev/urandom | od -A none -t x4.

cfg.encryption (bool)

  • Type: bool
  • Default: true
  • Description:
    Determines if encryption should be enabled. Set to false to disable encryption for testing purposes.

cfg.devNodes (string)

  • Type: string
  • Default: "/dev/disk/by-id/"
  • Description:
    Specifies where the disks should be mounted from.
    • Use /dev/disk/by-id/ for general systems.
    • Use /dev/disk/by-path/ for VMs.
    • For more information on disk name conventions, see OpenZFS FAQ.

let cfg = malobeo.disks.root

cfg.disk0 (string)

  • Type: string
  • Default: ""
  • Description:
    The device name (beginning after /dev/ e.g., sda) for the root filesystem.

cfg.disk1 (string)

  • Type: string
  • Default: ""
  • Description:
    The device name (beginning after /dev/ e.g., sdb) for the optional mirror disk of the root filesystem.

cfg.swap (string)

  • Type: string
  • Default: "8G"
  • Description:
    Size of the swap partition on disk0. This is applicable only for the root disk configuration.

cfg.reservation (string)

  • Type: string
  • Default: "20GiB"
  • Description:
    The ZFS reservation size for the root pool.

cfg.mirror (bool)

  • Type: bool
  • Default: false
  • Description:
    Whether to configure a mirrored ZFS root pool. Set to true to mirror the root filesystem across disk0 and disk1.

let cfg = malobeo.disks.storage

cfg.enable (bool)

  • Type: bool
  • Default: false
  • Description:
    Enables the creation of an additional storage pool. Set to true to create the storage pool.

cfg.disks (list of strings)

  • Type: listOf string
  • Default: []
  • Description:
    A list of device names without /dev/ prefix (e.g., sda, sdb) to include in the storage pool.
    Example: ["disks/by-id/ata-ST16000NE000-2RW103_ZL2P0YSZ"].

cfg.reservation (string)

  • Type: string
  • Default: "20GiB"
  • Description:
    The ZFS reservation size for the storage pool.

cfg.mirror (bool)

  • Type: bool
  • Default: false
  • Description:
    Whether to configure a mirrored ZFS storage pool. Set to true to mirror the storage pool.

Example Configuration

{
  options.malobeo.disks = {
    enable = true;
    hostId = "abcdef01";
    encryption = true;
    devNodes = "/dev/disk/by-id/";
    
    root = {
      disk0 = "sda";
      disk1 = "sdb";
      swap = "8G";
      reservation = "40GiB";
      mirror = true;
    };
    
    storage = {
      enable = true;
      disks = [ "sdc" "sdd" "disks/by-uuid/sde" ];
      reservation = "100GiB";
      mirror = false;
    };
  };
}