38 lines
1.2 KiB
Nix
38 lines
1.2 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
{
|
|
config = {
|
|
systemd.services.custom-install = {
|
|
description = "Custom installation script";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
path = [ pkgs.coreutils ];
|
|
preStart = "/run/current-system/sw/bin/sleep 4";
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
TTYPath = /dev/tty1; # or whichever TTY you want to use
|
|
StandardOutput = "tty";
|
|
StandardError = "tty";
|
|
};
|
|
|
|
script = ''
|
|
mkdir /home/nixos/installer
|
|
cp -R ${config.customPkgs.installFiles}/ /home/nixos/installer
|
|
ln -s /home/nixos/installer/bin/installer.sh /home/nixos/installer.sh
|
|
echo "Installer files are available in /home/nixos/installer"
|
|
echo "The installer.sh script is available in directly in /home/nixos/installer.sh"
|
|
'';
|
|
|
|
## Old install script
|
|
#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
|
|
#'';
|
|
};
|
|
};
|
|
} |