From dc87f8e0809d2c4453b8f6460e33a879af098574 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 18 Nov 2013 16:26:39 +0100 Subject: [PATCH] Check whether fileSystems defines the root FS --- nixos/modules/system/boot/stage-1.nix | 5 +++++ nixos/modules/tasks/filesystems.nix | 1 + 2 files changed, 6 insertions(+) diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index b2b66280372..7f7184b1e45 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -330,6 +330,11 @@ in config = { + assertions = singleton + { assertion = any (fs: fs.mountPoint == "/") (attrValues config.fileSystems); + message = "The ‘fileSystems’ option does not specify your root file system."; + }; + system.build.bootStage1 = bootStage1; system.build.initialRamdisk = initialRamdisk; system.build.extraUtils = extraUtils; diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index 3f484045ed4..b0bcd2eb373 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -81,6 +81,7 @@ in options = { fileSystems = mkOption { + default = {}; example = { "/".device = "/dev/hda1"; "/data" = {