{ flake, config, lib, pkgs, ... }: let cfg = config.installer.links; installerOutPath = { "cd-dvd" = _: installerBuild: "${installerBuild.config.system.build.isoImage}/iso"; "netboot" = {system, variant}: installerBuild: pkgs.runCommandLocal "${system}-${variant}" {} '' mkdir $out install -m 0444 -t $out \ ${installerBuild.config.system.build.netbootRamdisk}/initrd \ ${installerBuild.config.system.build.kernel}/${config.system.boot.loader.kernelFile} \ ${installerBuild.config.system.build.netbootIpxeScript}/netboot.ipxe \ ${pkgs.ipxe.override { additionalTargets = { "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; }; additionalOptions = [ "NSLOOKUP_CMD" "PING_CMD" "CONSOLE_CMD" ]; embedScript = pkgs.writeText "netboot.ipxe" '' #!ipxe chain netboot.ipxe ''; }}/{ipxe.efi,i386-ipxe.efi,ipxe.lkrn} ''; }; in { options = { installer.links = lib.mkOption { type = lib.types.listOf (lib.types.submodule { options = { system = lib.mkOption { type = lib.types.str; }; variant = lib.mkOption { type = lib.types.str; }; }; }); default = []; }; }; config = lib.mkIf (cfg != []) { systemd.tmpfiles.rules = map (installer'@{system, variant}: let installer = "${system}-${variant}"; installerBuild = builtins.addErrorContext "while evaluating installer-${installer}" flake.nixosConfigurations.${"installer-${installer}"}; in "L+ /run/installer-${installer} - - - - ${installerOutPath.${variant} installer' installerBuild}" ) cfg; }; }