Fix build with `documentation.nixos.includeAllModules = true;`

This includes the options of all modules used in the evaluation, not
just the ones from `<nixpkgs/nixos>` in the local manual.

Right now this breaks with

    error: attribute 'loader' missing

    at /nix/store/wf59fvxch3l5s7x0pnpfv7b26q6y010x-source/nix/modules/lanzaboote.nix:26:17:

        25|     configurationLimit = mkOption {
        26|       default = config.boot.loader.systemd-boot.configurationLimit;
          |                 ^
        27|       example = 120;

I'm not sure what's up with `config.boot.loader` (had the exact same
issue with `disko`), but using `defaultText` is the common workaround
for that.
This commit is contained in:
Maximilian Bosch 2023-10-13 22:35:58 +02:00
parent c865873ff5
commit 16c6776763
No known key found for this signature in database
GPG Key ID: 9A6EEA275CA5BE0A
1 changed files with 13 additions and 0 deletions

View File

@ -24,6 +24,7 @@ in
configurationLimit = mkOption { configurationLimit = mkOption {
default = config.boot.loader.systemd-boot.configurationLimit; default = config.boot.loader.systemd-boot.configurationLimit;
defaultText = "config.boot.loader.systemd-boot.configurationLimit";
example = 120; example = 120;
type = types.nullOr types.int; type = types.nullOr types.int;
description = lib.mdDoc '' description = lib.mdDoc ''
@ -43,18 +44,21 @@ in
publicKeyFile = mkOption { publicKeyFile = mkOption {
type = types.path; type = types.path;
default = "${cfg.pkiBundle}/keys/db/db.pem"; default = "${cfg.pkiBundle}/keys/db/db.pem";
defaultText = "\${cfg.pkiBundle}/keys/db/db.pem";
description = "Public key to sign your boot files"; description = "Public key to sign your boot files";
}; };
privateKeyFile = mkOption { privateKeyFile = mkOption {
type = types.path; type = types.path;
default = "${cfg.pkiBundle}/keys/db/db.key"; default = "${cfg.pkiBundle}/keys/db/db.key";
defaultText = "\${cfg.pkiBundle}/keys/db/db.key";
description = "Private key to sign your boot files"; description = "Private key to sign your boot files";
}; };
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.lzbt; default = pkgs.lzbt;
defaultText = "pkgs.lzbt";
description = "Lanzaboote tool (lzbt) package"; description = "Lanzaboote tool (lzbt) package";
}; };
@ -72,6 +76,15 @@ in
default = "nixos-*"; default = "nixos-*";
}; };
defaultText = ''
{
timeout = config.boot.loader.timeout;
console-mode = config.boot.loader.systemd-boot.consoleMode;
editor = config.boot.loader.systemd-boot.editor;
default = "nixos-*";
}
'';
example = literalExpression '' example = literalExpression ''
{ {
editor = null; # null value removes line from the loader.conf editor = null; # null value removes line from the loader.conf