This repository has been archived on 2024-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
simple-nixos-fediverse/installer.nix

30 lines
935 B
Nix
Raw Normal View History

/**
Convert a NixOS configuration to one for a minimal installer ISO
WARNING: Running this installer will format the target disk!
*/
nixpkgs: machine:
let
installer = { config, pkgs, ... }:
let
bootstrap = pkgs.writeShellApplication {
name = "bootstrap";
runtimeInputs = with pkgs; [ nixos-install-tools ];
text = ''
${machine.config.system.build.diskoScript}
nixos-install --no-root-password --no-channel-copy --system ${machine.config.system.build.toplevel}
'';
};
in
{
imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
];
nixpkgs.hostPlatform = "x86_64-linux";
programs.bash.loginShellInit = ''
${nixpkgs.lib.getExe bootstrap}
'';
};
in
(nixpkgs.lib.nixosSystem { modules = [installer];}).config.system.build.isoImage