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

View File

@ -1,12 +1,12 @@
{ pkgs, config, lib, ... }:
{ pkgs, config, lib, installFiles, ... }:
{
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";
path = [ pkgs.coreutils ];
preStart = "/run/current-system/sw/bin/sleep 4";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
@ -14,16 +14,28 @@
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
mkdir /home/nixos/installer
cp -R ${config.myPackages.installFiles}/ /home/nixos/installer
ln
cat > output.txt <<EOF
some text
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
#'';
};
};
}