Commit 13193234 authored by ajs124's avatar ajs124
Browse files

nixos/grub: turn definition of version option from an error into a warning

because a lot of configurations (generated by nixos-generate-config) contain it
parent 30bea8d8
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
{ config, lib, pkgs, ... }:
{ config, options, lib, pkgs, ... }:

with lib;

@@ -106,6 +106,11 @@ in
        '';
      };

      version = mkOption {
        visible = false;
        type = types.int;
      };

      device = mkOption {
        default = "";
        example = "/dev/disk/by-id/wwn-0x500001234567890a";
@@ -797,6 +802,10 @@ in
          assertion = cfg.efiInstallAsRemovable -> !config.boot.loader.efi.canTouchEfiVariables;
          message = "If you wish to to use boot.loader.grub.efiInstallAsRemovable, then turn off boot.loader.efi.canTouchEfiVariables";
        }
        {
          assertion = !(options.boot.loader.grub.version.isDefined && cfg.version == 1);
          message = "Support for version 0.9x of GRUB was removed after being unsupported upstream for around a decade";
        }
      ] ++ flip concatMap cfg.mirroredBoots (args: [
        {
          assertion = args.devices != [ ];
@@ -816,6 +825,11 @@ in
      }));
    })

    (mkIf options.boot.loader.grub.version.isDefined {
      warnings = [ ''
        The boot.loader.grub.version option does not have any effect anymore, please remove it from your configuration.
      '' ];
    })
  ];


@@ -845,7 +859,6 @@ in

        See the boot.initrd.secrets option documentation for more information.
      '')
      (mkRemovedOptionModule [ "boot" "loader" "grub" "version" ] "Support for version 0.9x of GRUB was removed after being unsupported upstream for around a decade")
    ];

}