Slight rework of the installer

This commit is contained in:
Nicolas Jeannerod 2024-11-07 18:36:43 +01:00
parent cd194f818d
commit f04b71047c
Signed by: Niols
GPG key ID: 35DB9EC8886E1CB8

View file

@ -3,29 +3,30 @@
WARNING: Running this installer will format the target disk! WARNING: Running this installer will format the target disk!
*/ */
nixpkgs: machine:
let { nixpkgs, ... }:
installer = { config, pkgs, lib, ... }: machine:
let
bootstrap = pkgs.writeShellApplication { let
name = "bootstrap"; installer = { config, pkgs, lib, ... }:
runtimeInputs = with pkgs; [ nixos-install-tools ]; let
text = '' bootstrap = pkgs.writeShellApplication {
${machine.config.system.build.diskoScript} name = "bootstrap";
nixos-install --no-root-password --no-channel-copy --system ${machine.config.system.build.toplevel} \ runtimeInputs = with pkgs; [ nixos-install-tools ];
&& poweroff text = ''
''; ${machine.config.system.build.diskoScript}
}; nixos-install --no-root-password --no-channel-copy --system ${machine.config.system.build.toplevel} \
in && poweroff
'';
};
in
{ {
imports = [ imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
]; ];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
services.getty.autologinUser = lib.mkForce "root"; services.getty.autologinUser = lib.mkForce "root";
programs.bash.loginShellInit = '' programs.bash.loginShellInit = nixpkgs.lib.getExe bootstrap;
${nixpkgs.lib.getExe bootstrap}
'';
isoImage = { isoImage = {
compressImage = false; compressImage = false;
@ -35,6 +36,5 @@ nixpkgs: machine:
## use `isoImage.isoName` in the tests. ## use `isoImage.isoName` in the tests.
}; };
}; };
in in
(nixpkgs.lib.nixosSystem { modules = [installer];}).config.system.build.isoImage (nixpkgs.lib.nixosSystem { modules = [installer]; }).config.system.build.isoImage