feat: Add iso and lxc generation artifacts
This commit is contained in:
committed by
Hunter Halloran
parent
5f68f6011c
commit
6498e7fd52
47
installer/auto-install.nix
Normal file
47
installer/auto-install.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{ config, lib, pkgs, inputs, hostName, hostPlatform, targetSystem, diskoScript, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
pkgs.git
|
||||
pkgs.bashInteractive
|
||||
pkgs.curl
|
||||
targetSystem
|
||||
];
|
||||
|
||||
# Enable networking
|
||||
networking.hostName = "autoinstaller-${hostName}";
|
||||
networking.networkmanager.enable = lib.mkForce false;
|
||||
networking.wireless = {
|
||||
enable = true;
|
||||
networks = {
|
||||
"IOT_sensors".psk = "aaaaaaaa";
|
||||
};
|
||||
};
|
||||
nixpkgs.hostPlatform = hostPlatform;
|
||||
|
||||
systemd.services.auto-install = {
|
||||
description = "Automatic NixOS install for ${hostName}";
|
||||
after = [ "network-online.target" "systemd-udev-settle.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
StandardOutput = "journal+console";
|
||||
StandardError = "journal+console";
|
||||
Environment = "PATH=/run/current-system/sw/bin";
|
||||
};
|
||||
|
||||
script = ''
|
||||
echo "=== AUTO INSTALL START for ${hostName} ==="
|
||||
|
||||
echo ">>> Running disko script..."
|
||||
${diskoScript}
|
||||
|
||||
echo ">>> Running nixos-install..."
|
||||
nixos-install --no-root-passwd --system ${targetSystem}
|
||||
|
||||
echo ">>> Done. Rebooting."
|
||||
systemctl reboot
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user