05918ec2ce
The ISO target had drifted from nixpkgs and no longer evaluated: `iso-image.nix` now defines `image.baseName` itself, which conflicts with ours, so force it. Drop the `boot.initrd.systemd.enable = false` override from the `asISO` build target. The missing `/dev/root` it worked around is no longer an issue, and scripted initrd is deprecated for removal in 26.11. Replace the wpa_supplicant stanza, which upstream's `installation-device.nix` no longer carries, with NetworkManager. Keep it out of `multi-user.target` so nothing network-related starts until asked; NetworkManager enables wpa_supplicant as its backend, which is D-Bus activated on demand. Pick up three more bits from that profile: the installer `variant_id`, the pstore drop-in that stops an install evacuating the target's persistent entries, and the mdadm `PROGRAM` stub that silences the unset-mail warning. Built and booted as an ISO to confirm. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
140 lines
4.6 KiB
Nix
140 lines
4.6 KiB
Nix
{
|
|
nixos.systems.installer = { config, ... }: {
|
|
system = "x86_64-linux";
|
|
nixpkgs = "mine";
|
|
docCustom = false;
|
|
rendered = config.configuration.config.my.asISO;
|
|
|
|
configuration =
|
|
{ lib, pkgs, modulesPath, config, ... }:
|
|
let
|
|
inherit (lib) mkDefault mkForce mkImageMediaOverride;
|
|
|
|
installRoot = "/mnt";
|
|
in
|
|
{
|
|
imports = [
|
|
# Useful tools to have
|
|
"${modulesPath}/profiles/base.nix"
|
|
];
|
|
|
|
config = {
|
|
my = {
|
|
# Lots of kernel modules and firmware
|
|
build.allHardware = true;
|
|
# Whatever installer mechanism is chosen will provide an appropriate `/`
|
|
tmproot.enable = false;
|
|
firewall.nat.enable = false;
|
|
deploy.enable = false;
|
|
user.enable = false;
|
|
|
|
server.enable = true;
|
|
};
|
|
|
|
image = {
|
|
baseName = mkForce "jackos-installer";
|
|
};
|
|
isoImage = {
|
|
volumeID = "jackos-${config.system.nixos.release}-${pkgs.stdenv.hostPlatform.uname.processor}";
|
|
edition = "devplayer0";
|
|
appendToMenuLabel = " /dev/player0 Installer";
|
|
};
|
|
|
|
environment.sessionVariables = {
|
|
INSTALL_ROOT = installRoot;
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [ lib.my.c.sshKeyFiles.deploy ];
|
|
home-manager.users.root = {
|
|
programs = {
|
|
starship.settings = {
|
|
hostname.ssh_only = false;
|
|
};
|
|
};
|
|
|
|
home.shellAliases = {
|
|
show-hw-config = "nixos-generate-config --show-hardware-config --root $INSTALL_ROOT";
|
|
};
|
|
|
|
my.gui.enable = false;
|
|
};
|
|
|
|
services = {
|
|
openssh.settings.PermitRootLogin = mkImageMediaOverride "prohibit-password";
|
|
};
|
|
|
|
networking = {
|
|
# Will be set dynamically, but need something to satisfy `/etc/os-release` stuff
|
|
hostName = "installer";
|
|
useNetworkd = false;
|
|
};
|
|
|
|
# This should be overridden by whatever boot mechanism is used
|
|
fileSystems."/" = mkDefault {
|
|
device = "none";
|
|
fsType = "tmpfs";
|
|
};
|
|
|
|
systemd.tmpfiles.rules = [
|
|
"d ${installRoot} 0755 root root"
|
|
];
|
|
boot.postBootCommands =
|
|
''
|
|
${pkgs.nettools}/bin/hostname "installer-$(${pkgs.coreutils}/bin/head -c4 /dev/urandom | \
|
|
${pkgs.coreutils}/bin/od -A none -t x4 | \
|
|
${pkgs.gawk}/bin/awk '{ print $1 }')"
|
|
'';
|
|
|
|
boot.supportedFilesystems.nfs = true;
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
dhcpcd
|
|
lm_sensors
|
|
ethtool
|
|
];
|
|
|
|
# Much of this onwards is yoinked from modules/profiles/installation-device.nix
|
|
# Good to have docs in the installer!
|
|
documentation.enable = mkForce true;
|
|
documentation.nixos.enable = mkForce true;
|
|
|
|
system.nixos.variant_id = mkDefault "installer";
|
|
|
|
# Enable NetworkManager, but don't start it by default.
|
|
networking.networkmanager.enable = true;
|
|
systemd.services = {
|
|
NetworkManager.wantedBy = mkForce [];
|
|
NetworkManager-wait-online.wantedBy = mkForce [];
|
|
NetworkManager-dispatcher.wantedBy = mkForce [];
|
|
# NetworkManager's wireless backend, D-Bus activated on demand
|
|
wpa_supplicant.wantedBy = mkForce [];
|
|
};
|
|
|
|
# Tell the Nix evaluator to garbage collect more aggressively.
|
|
# This is desirable in memory-constrained environments that don't
|
|
# (yet) have swap set up.
|
|
environment.variables.GC_INITIAL_HEAP_SIZE = "1M";
|
|
|
|
# Make the installer more likely to succeed in low memory
|
|
# environments. The kernel's overcommit heustistics bite us
|
|
# fairly often, preventing processes such as nix-worker or
|
|
# download-using-manifests.pl from forking even if there is
|
|
# plenty of free memory.
|
|
boot.kernel.sysctl."vm.overcommit_memory" = "1";
|
|
|
|
# Prevent installation media from evacuating persistent storage, as their
|
|
# var directory is not persistent and it would thus result in deletion of
|
|
# those entries.
|
|
environment.etc."systemd/pstore.conf".text = ''
|
|
[PStore]
|
|
Unlink=no
|
|
'';
|
|
|
|
# Remove warning about unset mail
|
|
boot.swraid.mdadmConf = "PROGRAM ${pkgs.coreutils}/bin/true";
|
|
|
|
services.lvm.boot.thin.enable = true;
|
|
};
|
|
};
|
|
};
|
|
}
|