{ 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 = "/bin/sleep 60"; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; }; 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 ''; }; }; }