ops/nixos: add netboot for netbooting a basic system with my defaults
This commit is contained in:
parent
ba65db5865
commit
8c4c8b3ccc
2 changed files with 42 additions and 0 deletions
|
@ -52,8 +52,12 @@ let
|
|||
stockExporters ++ customExporters;
|
||||
in
|
||||
builtins.listToAttrs (builtins.concatLists (lib.mapAttrsToList exportersForSystem evaledSystems));
|
||||
|
||||
netbootSystem = systemFor "netboot" (import ./netboot);
|
||||
in systemDrvs // {
|
||||
systems = systemDrvs;
|
||||
systemExporters = systemExporters;
|
||||
tailscaleIPs = systemTailscaleIPs;
|
||||
|
||||
netboot = netbootSystem.config.system.build.pixiecore;
|
||||
}
|
||||
|
|
38
ops/nixos/netboot/default.nix
Normal file
38
ops/nixos/netboot/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
# 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";
|
||||
}
|
Loading…
Reference in a new issue