nixfiles/hosts/hetzner-arm-installer/hetzner-arm-installer.nix

49 lines
1.3 KiB
Nix
Raw Normal View History

2023-09-19 22:30:02 +01:00
{
tree,
modulesPath,
pkgs,
config,
lib,
...
}: let
inherit (lib.strings) escapeShellArgs;
in {
nixpkgs.overlays = [
(final: prev: {
# skips building zsh docs
zsh = prev.zsh.overrideAttrs {
nativeBuildInputs = with final; [autoreconfHook perl groff texinfo pcre util-linux];
};
})
];
imports = with tree; [
(modulesPath + "/installer/netboot/netboot-minimal.nix")
profiles.sshd
users.root
];
boot.kernelParams = ["console=tty0" "console=ttyAMA0,115200" "console=ttyS0,115200"];
documentation.enable = false;
netboot.squashfsCompression = "zstd -Xcompression-level 1";
system.build = {
kexecTarball = pkgs.runCommand "kexec-tarball" {} ''
mkdir kexec $out
cp "${config.system.build.netbootRamdisk}/initrd" kexec/initrd
cp "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}" kexec/bzImage
install -D -m 0755 ${./run.sh} kexec/run
sed -i \
-e 's|@init@|${config.system.build.toplevel}/init|' \
-e 's|@kernelParams@|${escapeShellArgs config.boot.kernelParams}|' \
kexec/run
cp "${pkgs.pkgsStatic.kexec-tools}/bin/kexec" kexec/kexec
tar -cf $out/hetzner-arm-installer.tar kexec
'';
};
system.stateVersion = "23.11";
}