extlinux.nix (1034B)
1 { 2 config 3 , pkgs 4 , lib 5 , ... 6 }: 7 let 8 inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep; 9 cfg = config.boot.loader.extlinux; 10 o = config.system.outputs; 11 cmdline = concatStringsSep " " config.boot.commandLine; 12 wantsDtb = config.hardware.dts ? src && config.hardware.dts.src != null; 13 in { 14 options.system.outputs.extlinux = mkOption { 15 type = types.package; 16 # description = ""; 17 }; 18 options.boot.loader.extlinux.enable = mkEnableOption "extlinux"; 19 20 config = { # mkIf cfg.enable { 21 system.outputs.extlinux = pkgs.runCommand "extlinux" {} '' 22 mkdir $out 23 cd $out 24 ${if wantsDtb then "cp ${o.dtb} dtb" else "true"} 25 cp ${o.initramfs} initramfs 26 cp ${o.zimage} kernel 27 mkdir extlinux 28 cat > extlinux/extlinux.conf << _EOF 29 menu title Liminix 30 timeout 100 31 label Liminix 32 kernel /boot/kernel 33 # initrd /boot/initramfs 34 append ${cmdline} root=/dev/vda1 35 ${if wantsDtb then "fdt /boot/dtb" else ""} 36 _EOF 37 ''; 38 }; 39 }