modified: auto-installer/installer.nix

This commit is contained in:
2025-07-21 10:33:21 +10:00
parent 094b6c34f0
commit 706e74c46d

View File

@@ -37,10 +37,10 @@ environment.etc."git-credentials".text =
mkdir -p /mnt/install-tmp mkdir -p /mnt/install-tmp
export TMPDIR=/mnt/install-tmp export TMPDIR=/mnt/install-tmp
parted /dev/sda -- mklabel msdos parted -s /dev/sda -- mklabel msdos
parted /dev/sda -- mkpart primary 1MB -8GB parted -s /dev/sda -- mkpart primary 1MB -8GB
parted /dev/sda -- set 1 boot on parted -s /dev/sda -- set 1 boot on
parted /dev/sda -- mkpart primary linux-swap -8GB 100% parted -s /dev/sda -- mkpart primary linux-swap -8GB 100%
mkfs.ext4 -L nixos /dev/sda1 mkfs.ext4 -L nixos /dev/sda1
mkswap -L swap /dev/sda2 mkswap -L swap /dev/sda2
swapon /dev/sda2 swapon /dev/sda2
@@ -53,20 +53,33 @@ environment.etc."git-credentials".text =
''; '';
environment.etc."auto-install.sh".mode = "0755"; environment.etc."auto-install.sh".mode = "0755";
systemd.services.autoInstallInteractive = { # systemd.services.autoInstallInteractive = {
description = "Interactive NixOS installer on tty1"; # description = "Interactive NixOS installer on tty1";
conflicts = [ "getty@tty1.service" ]; # conflicts = [ "getty@tty1.service" ];
# after = [ "getty@tty1.service" ];
# wantedBy = [ "multi-user.target" ];
# serviceConfig = {
# Type = "simple";
# StandardInput = "tty";
# StandardOutput = "inherit";
# TTYPath = "/dev/tty1";
# TTYReset = true;
# TTYVHangup = true;
# };
systemd.services."autovt@tty1" = {
description = "Run installer script on TTY1";
after = [ "getty@tty1.service" ]; after = [ "getty@tty1.service" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
Type = "simple"; ExecStart = [ "" "@${pkgs.util-linux}/sbin/agetty" "agetty --noclear --autologin root --login-program /etc/auto-install.sh %I $TERM" ];
StandardInput = "tty"; Type = "idle"; # wait for console initialization
StandardOutput = "inherit"; Restart = "no";
TTYPath = "/dev/tty1";
TTYReset = true;
TTYVHangup = true;
}; };
path = [ path = [
pkgs.bash pkgs.bash
pkgs.parted pkgs.parted
@@ -76,7 +89,7 @@ environment.etc."git-credentials".text =
pkgs.git pkgs.git
]; ];
# Run script attached to tty1 # Run script attached to tty1
script = "exec /etc/auto-install.sh"; # script = "exec /etc/auto-install.sh";
}; };
# systemd.services.autoInstall = { # systemd.services.autoInstall = {
# description = "Automatic NixOS installation"; # description = "Automatic NixOS installation";