1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 blCfg = config.boot.loader; 7 cfg = blCfg.generic-extlinux-compatible; 8 9 timeoutStr = if blCfg.timeout == null then "-1" else toString blCfg.timeout; 10 11 builder = import ./extlinux-conf-builder.nix { inherit pkgs; }; 12in 13{ 14 options = { 15 boot.loader.generic-extlinux-compatible = { 16 enable = mkOption { 17 default = false; 18 type = types.bool; 19 description = '' 20 Whether to generate an extlinux-compatible configuration file 21 under <literal>/boot/extlinux.conf</literal>. For instance, 22 U-Boot's generic distro boot support uses this file format. 23 24 See <link xlink:href="http://git.denx.de/?p=u-boot.git;a=blob;f=doc/README.distro;hb=refs/heads/master">U-boot's documentation</link> 25 for more information. 26 ''; 27 }; 28 29 configurationLimit = mkOption { 30 default = 20; 31 example = 10; 32 type = types.int; 33 description = '' 34 Maximum number of configurations in the boot menu. 35 ''; 36 }; 37 }; 38 }; 39 40 config = mkIf cfg.enable { 41 system.build.installBootLoader = "${builder} -g ${toString cfg.configurationLimit} -t ${timeoutStr} -c"; 42 system.boot.loader.id = "generic-extlinux-compatible"; 43 }; 44}