pxescript: add helper
This commit is contained in:
parent
b9fe945baf
commit
4bd4603382
@ -8,6 +8,8 @@
|
|||||||
nix = nixUnstable;
|
nix = nixUnstable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
makePxeScript = callPackage ./pxescript {};
|
||||||
|
|
||||||
makeSquashfsManifest = callPackage ./squashfs-recursive {
|
makeSquashfsManifest = callPackage ./squashfs-recursive {
|
||||||
# nixUnstable may not be required. Todo: revisit (2020-05-25)
|
# nixUnstable may not be required. Todo: revisit (2020-05-25)
|
||||||
nix = nixUnstable;
|
nix = nixUnstable;
|
||||||
|
|||||||
39
pkgs/pxescript/default.nix
Normal file
39
pkgs/pxescript/default.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{ stdenv, runCommand }:
|
||||||
|
{ config
|
||||||
|
, initrds ? {}
|
||||||
|
, pkgs
|
||||||
|
,
|
||||||
|
}:
|
||||||
|
runCommand "netboot" {
|
||||||
|
pxe = ''
|
||||||
|
#!ipxe
|
||||||
|
kernel ${pkgs.stdenv.hostPlatform.platform.kernelTarget} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams}
|
||||||
|
${builtins.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (name: path: "initrd ${name}") initrds))}
|
||||||
|
initrd initrd
|
||||||
|
boot
|
||||||
|
'';
|
||||||
|
} ''
|
||||||
|
mkdir stage
|
||||||
|
cd stage
|
||||||
|
ln -s "${config.system.build.kernel}/${pkgs.stdenv.hostPlatform.platform.kernelTarget}" ./
|
||||||
|
|
||||||
|
set -x
|
||||||
|
${builtins.concatStringsSep "\n"
|
||||||
|
(
|
||||||
|
builtins.attrValues
|
||||||
|
(
|
||||||
|
builtins.mapAttrs
|
||||||
|
(
|
||||||
|
name: path: ''
|
||||||
|
test -f "$(realpath "${path}")"
|
||||||
|
ln -s ${path} ./${name}
|
||||||
|
''
|
||||||
|
) initrds
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
set +x
|
||||||
|
echo "$pxe" > netboot.ipxe
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
mv stage $out
|
||||||
|
''
|
||||||
Loading…
Reference in New Issue
Block a user