From 317ad27b2a0365fca31f3143cfbc47d21066bc74 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Thu, 29 Feb 2024 20:59:48 +0100 Subject: [PATCH] make storage.osDisk optional --- nixos/machines/warwick.nix | 7 ------- nixos/modules/storage.nix | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/nixos/machines/warwick.nix b/nixos/machines/warwick.nix index 4c0bb8a..2e7c91f 100644 --- a/nixos/machines/warwick.nix +++ b/nixos/machines/warwick.nix @@ -3,12 +3,5 @@ kind = "physical"; arch = "aarch64-linux"; isRaspberryPi = true; - - nixosModule.lab = { - # TODO: can we do this differently? - storage = { - osDisk = "/dev/sda"; - }; - }; }; } diff --git a/nixos/modules/storage.nix b/nixos/modules/storage.nix index 94e3365..46018bf 100644 --- a/nixos/modules/storage.nix +++ b/nixos/modules/storage.nix @@ -3,7 +3,7 @@ let cfg = config.lab.storage; in { options.lab.storage = { osDisk = lib.mkOption { - type = lib.types.str; + type = with lib.types; nullOr str; description = '' The disk to be used for the machine's operating system. ''; @@ -40,8 +40,8 @@ in { }) ]; - # TODO: Rename this to 'osDisk'. Unfortunately, we would need to run nixos-anywhere again then. disko = lib.mkIf machine.isHypervisor { + # TODO: Rename this to 'osDisk'. Unfortunately, we would need to run nixos-anywhere again then. devices.disk.vdb = { device = cfg.osDisk; type = "disk";