depot/ops/nixos/netboot/default.nix

39 lines
1.1 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ depot, lib, pkgs, rebuilder, config, ... }:
let
inherit (depot.ops) secrets;
in {
imports = [
../../../third_party/nixpkgs/nixos/modules/installer/netboot/netboot-minimal.nix
];
environment.noXlibs = false;
services.getty.autologinUser = lib.mkForce "root";
systemd.services.sshd.wantedBy = lib.mkOverride 0 [ "multi-user.target" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
system.build.netbootWrap = pkgs.symlinkJoin {
name = "netboot";
paths = with config.system.build; [
netbootRamdisk
kernel
netbootIpxeScript
];
};
system.build.pixiecore = pkgs.writeScript "netboot-pixiecore.sh" ''
n="$(realpath ${config.system.build.netbootWrap})"
init="$(grep -ohP 'init=\S+' "$n/netboot.ipxe")"
pixiecore="${pkgs.pixiecore}"
exec "$pixiecore/bin/pixiecore" \
boot "$n/bzImage" "$n/initrd" \
--cmdline "$init loglevel=4" \
--debug --dhcp-no-bind --port 64172 --status-port 64172
'';
system.stateVersion = "21.05";
}