2026-01-13 09:35:53 +00:00
|
|
|
{ pkgs ? import <nixpkgs> { }, autoInstall ? false, extra-substituters ? ""
|
|
|
|
|
, config-file-name ? "configuration.nix", extra-trusted-public-keys ? ""
|
|
|
|
|
, version ? "", ... }:
|
2025-12-11 13:10:10 +00:00
|
|
|
let
|
2025-12-11 15:18:54 +00:00
|
|
|
installer = pkgs.callPackage ../aster_nixos_installer {
|
2026-01-13 09:35:53 +00:00
|
|
|
inherit extra-substituters extra-trusted-public-keys config-file-name;
|
2025-12-11 15:18:54 +00:00
|
|
|
};
|
2025-12-11 13:10:10 +00:00
|
|
|
configuration = {
|
|
|
|
|
imports = [
|
|
|
|
|
"${pkgs.path}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
|
|
|
|
"${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix"
|
|
|
|
|
];
|
|
|
|
|
|
2025-12-12 08:53:04 +00:00
|
|
|
system.nixos.distroName = "Asterinas NixOS";
|
|
|
|
|
system.nixos.label = "${version}";
|
|
|
|
|
isoImage.appendToMenuLabel = " Installer";
|
|
|
|
|
|
2025-12-11 13:10:10 +00:00
|
|
|
services.getty.autologinUser = pkgs.lib.mkForce "root";
|
|
|
|
|
environment.systemPackages = [ installer ];
|
|
|
|
|
environment.loginShellInit = ''
|
|
|
|
|
if [ ! -e "$HOME/configuration.nix" ]; then
|
2025-12-13 00:51:44 +00:00
|
|
|
# Create an editable copy of configuration.nix in user's home.
|
|
|
|
|
cp -L ${installer}/etc_nixos/configuration.nix $HOME && chmod u+w $HOME/configuration.nix
|
2025-12-11 13:10:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
${pkgs.lib.optionalString autoInstall ''
|
|
|
|
|
if [ "$(tty)" == "/dev/hvc0" ]; then
|
|
|
|
|
echo "The installer automatically runs on /dev/hvc0!"
|
|
|
|
|
install_aster_nixos.sh --config $HOME/configuration.nix --disk /dev/vda --force-format-disk || true
|
|
|
|
|
poweroff
|
|
|
|
|
fi
|
|
|
|
|
''}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
in (pkgs.nixos configuration).config.system.build.isoImage
|