add config block

This commit is contained in:
Richard Mauer 2025-01-01 18:27:07 -05:00
parent 96d409b636
commit 912a6b7242
2 changed files with 25 additions and 13 deletions

View File

@ -10,7 +10,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
./diskco.nix ./diskco.nix
]; ];
config = {
# Bootloader. # Bootloader.
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
@ -162,5 +162,5 @@ fi
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?
};
} }

View File

@ -1,12 +1,12 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, installFiles, ... }:
{ {
config = { config = {
systemd.services.custom-install = { systemd.services.custom-install = {
description = "Custom installation script"; description = "Custom installation script";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
path = [ pkgs.util-linux pkgs.parted pkgs.nixos-install-tools pkgs.nixos-anywhere pkgs.disko ]; path = [ pkgs.coreutils ];
preStart = "/run/current-system/sw/bin/sleep 60"; preStart = "/run/current-system/sw/bin/sleep 4";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
@ -16,14 +16,26 @@
}; };
script = '' script = ''
# Your installation commands here mkdir /home/nixos/installer
if [ ! -f /etc/installation-completed ]; then cp -R ${config.myPackages.installFiles}/ /home/nixos/installer
# Run your installation steps ln
"${config.myPackages.installFiles}/bin/install.sh"
# Mark as completed cat > output.txt <<EOF
touch /etc/installation-completed some text
fi some lines
EOF
''; '';
## 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
#'';
}; };
}; };
} }