Unverified Commit ce5163a6 authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

nixos/systemd-initrd: support omitting kernel parameter root (#506753)

parents d5fa3368 e6909f5a
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -265,10 +265,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 = ''
@@ -277,6 +279,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`.
      '';
    };

@@ -489,9 +492,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.