You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
{ pkgs, lib, config, modulesPath, managerConfig, ... }:
with lib;
let auto-install = pkgs.writers.writeBash "auto-install" ''
set -o errexit set -o nounset set -o pipefail
set -x
if [[ "$(cat /proc/cmdline)" =~ nixos\.install=([^ ]+) ]]; then INSTALL="''${BASH_REMATCH[1]}" else echo "No install derivation found" >&2 exit 1 fi
${pkgs.retry}/bin/retry \ --times 10 \ --delay 15 \ -- ${pkgs.nix}/bin/nix-store \ --realize \ --add-root /tmp/install \ "$INSTALL"
exec /tmp/install '';
in { imports = [ "${modulesPath}/installer/netboot/netboot-minimal.nix" ];
config = { services.getty.autologinUser = lib.mkForce "root";
networking.hostName = "installer"; networking.hosts = mkForce managerConfig.networking.hosts;
users.users."root" = mkForce managerConfig.users.users."root";
systemd.services."auto-install" = { description = "Automated NixOS installer";
wants = [ "network-online.target" ]; after = [ "network-online.target" ];
conflicts = [ "getty@tty1.service" ];
wantedBy = [ "multi-user.target" ];
path = [ pkgs.bash pkgs.nix ];
unitConfig = { AssertKernelCommandLine = "nixos.install";
FailureAction = "reboot-force"; };
serviceConfig = { Type = "oneshot";
ExecStart = auto-install;
StandardInput = "tty-force"; TTYPath = "/dev/tty1"; TTYVTDisallocate = false; }; };
nix.settings = { substituters = [ "http://cache.${managerConfig.networking.domain}" ]; trusted-public-keys = [ (fileContents managerConfig.gather.parts."cache/key".path) ]; };
system.stateVersion = config.system.nixos.release; }; }
|