make extlinux work with liminix-rebuild

add /boot to the systemConfiguration closure
pull/3/head
Daniel Barlow 2024-01-08 18:58:07 +00:00
parent 9a3d7a387e
commit c1101d3af5
3 changed files with 21 additions and 5 deletions

View File

@ -44,11 +44,12 @@ in rec {
../modules/ntp ../modules/ntp
../modules/ssh ../modules/ssh
../modules/outputs/btrfs.nix ../modules/outputs/btrfs.nix
../modules/outputs/extlinux.nix
]; ];
hostname = "rotuer"; hostname = "rotuer";
rootfsType = "btrfs"; rootfsType = "btrfs";
rootOptions = "subvol=@"; rootOptions = "subvol=@";
boot.loader.extlinux.enable = true;
services.hostap = svc.hostapd.build { services.hostap = svc.hostapd.build {
interface = config.hardware.networkInterfaces.wlan; interface = config.hardware.networkInterfaces.wlan;

View File

@ -6,6 +6,7 @@
}: }:
let let
inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep; inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep;
inherit (pkgs.pseudofile) dir symlink;
cfg = config.boot.loader.extlinux; cfg = config.boot.loader.extlinux;
o = config.system.outputs; o = config.system.outputs;
cmdline = concatStringsSep " " config.boot.commandLine; cmdline = concatStringsSep " " config.boot.commandLine;
@ -17,7 +18,7 @@ in {
}; };
options.boot.loader.extlinux.enable = mkEnableOption "extlinux"; options.boot.loader.extlinux.enable = mkEnableOption "extlinux";
config = { # mkIf cfg.enable { config = mkIf cfg.enable {
system.outputs.extlinux = pkgs.runCommand "extlinux" {} '' system.outputs.extlinux = pkgs.runCommand "extlinux" {} ''
mkdir $out mkdir $out
cd $out cd $out
@ -27,7 +28,7 @@ in {
mkdir extlinux mkdir extlinux
cat > extlinux/extlinux.conf << _EOF cat > extlinux/extlinux.conf << _EOF
menu title Liminix menu title Liminix
timeout 100 timeout 40
label Liminix label Liminix
kernel /boot/kernel kernel /boot/kernel
# initrd /boot/initramfs # initrd /boot/initramfs
@ -35,5 +36,8 @@ in {
${if wantsDtb then "fdt /boot/dtb" else ""} ${if wantsDtb then "fdt /boot/dtb" else ""}
_EOF _EOF
''; '';
filesystem = dir {
boot = symlink config.system.outputs.extlinux;
};
}; };
} }

View File

@ -84,8 +84,19 @@ in attrset:
#!/bin/sh -e #!/bin/sh -e
prefix=\''${1-/} prefix=\''${1-/}
src=\''${prefix}$out src=\''${prefix}$out
mkdir -p \$prefix/persist dest=\$prefix
cp -v -fP \$src/bin/* \$src/etc/* \$prefix/persist ${# if we are running on a normal mounted system then
# the actual device root is mounted on /persist
# and /nix is bind mounted from /persist/nix
# (see the code in preinit). So we need to check for this
# case otherwise we will install into a ramfs/rootfs
""
}
if test -d $dest/persist; then dest=$dest/persist; fi
cp -v -fP \$src/bin/* \$src/etc/* \$dest
${if attrset ? boot then ''
(cd \$prefix && rm ./boot && ln -sf ${lib.strings.removePrefix "/" attrset.boot.target} ./boot)
'' else ""}
EOF EOF
chmod +x $out/bin/install chmod +x $out/bin/install
''; '';