rpi-netboot: move tftproot from flake.nix into module
This commit is contained in:
parent
b1363d4286
commit
89909fa8e4
21
flake.nix
21
flake.nix
|
@ -205,21 +205,8 @@
|
||||||
meta.mainProgram = "run-${host}-vm";
|
meta.mainProgram = "run-${host}-vm";
|
||||||
});
|
});
|
||||||
} //
|
} //
|
||||||
nixpkgs.lib.optionalAttrs config.boot.loader.raspberryPi.enable {
|
nixpkgs.lib.optionalAttrs (config.system.build ? tftproot) {
|
||||||
"${host}-boot" = pkgs.runCommand "tftproot" {} ''
|
"${host}-tftproot" = config.system.build.tftproot;
|
||||||
mkdir -p $out
|
|
||||||
cp -rs ${pkgs.raspberrypifw}/share/raspberrypi/boot/* $out/
|
|
||||||
rm -f $out/kernel8.img $out/initrd.img
|
|
||||||
ln -s ${config.system.build.kernel}/Image $out/kernel8.img
|
|
||||||
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd.img
|
|
||||||
cat << EOF > $out/config.txt
|
|
||||||
kernel=kernel8.img
|
|
||||||
initramfs initrd.img followkernel
|
|
||||||
gpu_mem=64
|
|
||||||
arm_64bit=1
|
|
||||||
EOF
|
|
||||||
echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 verbose init=${config.system.build.toplevel}/init" > $out/cmdline.txt
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
) {} (builtins.attrNames self.nixosConfigurations)
|
) {} (builtins.attrNames self.nixosConfigurations)
|
||||||
) self.legacyPackages;
|
) self.legacyPackages;
|
||||||
|
@ -550,6 +537,10 @@
|
||||||
) (builtins.mapAttrs (_: nixosSystem:
|
) (builtins.mapAttrs (_: nixosSystem:
|
||||||
nixosSystem.config.system.build.toplevel
|
nixosSystem.config.system.build.toplevel
|
||||||
) self.nixosConfigurations)
|
) self.nixosConfigurations)
|
||||||
|
//
|
||||||
|
nixpkgs.lib.filterAttrs (name: _:
|
||||||
|
builtins.match ".+-tftproot" name != null
|
||||||
|
) self.packages.${system}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ hostRegistry, pkgs, lib, ... }:
|
{ hostRegistry, config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
boot = {
|
boot = {
|
||||||
loader.raspberryPi = {
|
loader.raspberryPi = {
|
||||||
|
@ -59,4 +59,19 @@
|
||||||
services.journald.extraConfig = ''
|
services.journald.extraConfig = ''
|
||||||
Storage=volatile
|
Storage=volatile
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
system.build.tftproot = pkgs.runCommand "tftproot-${config.networking.hostName}" {} ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -rs ${pkgs.raspberrypifw}/share/raspberrypi/boot/* $out/
|
||||||
|
rm -f $out/kernel8.img $out/initrd.img
|
||||||
|
ln -s ${config.system.build.kernel}/Image $out/kernel8.img
|
||||||
|
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd.img
|
||||||
|
cat << EOF > $out/config.txt
|
||||||
|
kernel=kernel8.img
|
||||||
|
initramfs initrd.img followkernel
|
||||||
|
gpu_mem=64
|
||||||
|
arm_64bit=1
|
||||||
|
EOF
|
||||||
|
echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 verbose init=${config.system.build.toplevel}/init" > $out/cmdline.txt
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue