netboot.nix/installer/installer.nix
2024-12-31 18:47:09 -05:00

29 lines
866 B
Nix

{ pkgs, config, lib, ... }:
{
config = {
systemd.services.custom-install = {
description = "Custom installation script";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ pkgs.util-linux pkgs.parted pkgs.nixos-install-tools pkgs.nixos-anywhere pkgs.disko ];
preStart = "/run/current-system/sw/bin/sleep 60";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
TTYPath = /dev/tty1; # or whichever TTY you want to use
StandardOutput = "tty";
StandardError = "tty";
};
script = ''
# Your installation commands here
if [ ! -f /etc/installation-completed ]; then
# Run your installation steps
"${config.myPackages.installFiles}/bin/install.sh"
# Mark as completed
touch /etc/installation-completed
fi
'';
};
};
}