2023-12-02 16:31:55 +01:00
|
|
|
{
|
|
|
|
config
|
|
|
|
, pkgs
|
|
|
|
, lib
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep;
|
|
|
|
cfg = config.boot.loader.extlinux;
|
|
|
|
o = config.system.outputs;
|
|
|
|
cmdline = concatStringsSep " " config.boot.commandLine;
|
|
|
|
in {
|
|
|
|
options.system.outputs.extlinux = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
# description = "";
|
|
|
|
};
|
|
|
|
options.boot.loader.extlinux.enable = mkEnableOption "extlinux";
|
|
|
|
|
|
|
|
config = { # mkIf cfg.enable {
|
|
|
|
system.outputs.extlinux = pkgs.runCommand "extlinux" {} ''
|
|
|
|
mkdir $out
|
|
|
|
cd $out
|
2023-12-06 00:16:53 +01:00
|
|
|
# cp {o.dtb} dtb
|
|
|
|
cp ${o.initramfs} initramfs
|
2023-12-02 16:31:55 +01:00
|
|
|
gzip -9f < ${o.kernel} > kernel.gz
|
2023-12-06 00:16:53 +01:00
|
|
|
mkdir extlinux
|
|
|
|
cat > extlinux/extlinux.conf << _EOF
|
2023-12-02 16:31:55 +01:00
|
|
|
menu title Liminix
|
|
|
|
timeout 100
|
|
|
|
label Liminix
|
2023-12-06 00:16:53 +01:00
|
|
|
kernel /boot/kernel.gz
|
|
|
|
initrd /boot/initramfs
|
2023-12-02 16:31:55 +01:00
|
|
|
append ${cmdline}
|
2023-12-06 00:16:53 +01:00
|
|
|
# fdt /boot/dtb
|
2023-12-02 16:31:55 +01:00
|
|
|
_EOF
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|