Commit e6909f5a authored by Christian Kögler's avatar Christian Kögler
Browse files

nixos/systemd-initrd: support omitting kernel parameter root

parent 8110df5a
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -260,10 +260,12 @@ in
    };

    root = lib.mkOption {
      type = lib.types.enum [
      type = lib.types.nullOr (
        lib.types.enum [
          "fstab"
          "gpt-auto"
      ];
        ]
      );
      default = "fstab";
      example = "gpt-auto";
      description = ''
@@ -272,6 +274,7 @@ in
        allow specifying the root file system itself this
        way. Instead, the `fstab` value is used in order to interpret
        the root file system specified with the `fileSystems` option.
        If root shall be omitted, set this option to `null`.
      '';
    };

@@ -469,9 +472,9 @@ in
    ]
    ++ lib.optional cfg.package.withEfi "efivarfs";

    boot.kernelParams = [
      "root=${config.boot.initrd.systemd.root}"
    ]
    boot.kernelParams =
      lib.optional (config.boot.initrd.systemd.root != null) "root=${config.boot.initrd.systemd.root}"

      ++ lib.optional (config.boot.resumeDevice != "") "resume=${config.boot.resumeDevice}"
      # `systemd` mounts root in initrd as read-only unless "rw" is on the kernel command line.
      # For NixOS activation to succeed, we need to have root writable in initrd.