NixOS deployment for LinuxLab
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, modulesPath, config, ... }:
with lib;
let auto-installer = pkgs.writers.writeBash "auto-installer" ''
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/installer \ "$INSTALL"
exec /tmp/installer '';
in { imports = [ "${modulesPath}/installer/netboot/netboot-minimal.nix"
./shared/network.nix ./shared/cache.nix ./shared/users.nix ];
_module.args = { name = "installer"; };
networking.useDHCP = mkForce true;
services.getty.autologinUser = lib.mkForce "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 = with pkgs; [ bash nix ];
unitConfig = { AssertKernelCommandLine = "nixos.install";
FailureAction = "force-reboot"; };
serviceConfig = { Type = "oneshot";
ExecStart = auto-installer;
StandardInput = "none"; StandardOutput = "journal+console"; StandardError = "journal+console"; }; };
system.stateVersion = config.system.nixos.release; }
|