Files
NixOsConfig/modules/installer/default.nix
T

76 lines
2.0 KiB
Nix

# Installer ISO (`nix build .#iso`): the minimal NixOS installer plus this
# flake and the install tooling. Wired up in lib/default.nix (mkInstaller).
{
lib,
pkgs,
inputs,
self,
...
}:
let
inherit (pkgs.stdenv.hostPlatform) system;
# Every flake input including nested ones, so the sources are on the ISO and
# a locked flake installs without re-downloading them.
allInputs = builtins.genericClosure {
startSet = map (i: {
key = toString i.outPath;
inherit i;
}) (lib.attrValues inputs);
operator =
x:
map (i: {
key = toString i.outPath;
inherit i;
}) (lib.attrValues (x.i.inputs or { }));
};
in
{
nix.settings = {
experimental-features = [
"nix-command"
"flakes"
];
# The flake's nixConfig lists binary caches (Noctalia, nix-community).
accept-flake-config = true;
};
# nmtui / nmcli instead of wpa_supplicant.
networking.networkmanager.enable = true;
networking.wireless.enable = lib.mkForce false;
environment.systemPackages = [
pkgs.install-system
pkgs.create-keys
pkgs.set-password
pkgs.secret-from-file
pkgs.git
pkgs.jq
pkgs.age
pkgs.sbctl
pkgs.btrfs-progs
pkgs.neovim
inputs.disko.packages.${system}.disko
inputs.agenix.packages.${system}.default
];
# The flake itself, read-only. install-system copies it before changing it.
environment.etc."nixos-config".source = self;
system.extraDependencies = map (x: x.i.outPath) allInputs;
users.motd = ''
NixOS installer for the "desktop" flake
1. Network: nmtui (Ethernet works out of the box)
2. Install: sudo install-system
(flake: /etc/nixos-config, or --flake DIR for a copy on a stick;
--keys-dir DIR for keys/ on a mounted stick)
3. Keys: create-keys, set-password, secret-from-file (see the README)
install-system asks which disks to use and erases them only after you type the host name.
'';
}