57 lines
1.4 KiB
Nix
57 lines
1.4 KiB
Nix
# flake.nix
|
|
{
|
|
description = "Auto-install NixOS ISO";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
nixos-generators.url = "github:nix-community/nixos-generators";
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, nixos-generators, home-manager, ... }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
iso = nixos-generators.nixosGenerate {
|
|
inherit system;
|
|
format = "install-iso";
|
|
modules = [
|
|
./installer.nix
|
|
];
|
|
};
|
|
|
|
netboot = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
modules = [
|
|
./installer.nix
|
|
|
|
({ modulesPath, ... }: {
|
|
imports = [
|
|
(modulesPath + "/installer/netboot/netboot-minimal.nix")
|
|
];
|
|
|
|
# 🔥 critical: prevent ISO/live media assumptions
|
|
boot.supportedFilesystems = [ "tmpfs" "vfat" "ext4" ];
|
|
boot.kernelParams = [
|
|
"ip=dhcp"
|
|
];
|
|
|
|
# optional but helps avoid root confusion
|
|
fileSystems."/" = {
|
|
device = "tmpfs";
|
|
fsType = "tmpfs";
|
|
};
|
|
})
|
|
];
|
|
};
|
|
in {
|
|
packages.default = iso;
|
|
|
|
packages.netboot = netboot.config.system.build.netboot;
|
|
});
|
|
}
|