feat: nomarchy-install — guided live-ISO installer (disko + mkFlake)
Ported from the previous iteration's installer (3bdfc35), adapted to the
mkFlake world. gum TUI: disk pick, optional LUKS2, user/hostname/timezone,
DMI → nixos-hardware autodetection (hardware-db.sh). disko partitions
GPT + 1 GiB ESP + BTRFS subvolumes; the generated machine flake lands at
~user/.nomarchy (one mkFlake call, /etc/nixos symlinks to it) and
nixos-install makes it bootable (UEFI/systemd-boot, v1 single disk).
Offline by construction: the target flake.lock is composed from the rev
the ISO was built from (compose-lock.py), `nix flake archive` seeds the
target store, and the ISO pre-builds the template system + desktop.
First boot lands themed: the HM generation is pre-activated in chroot.
mkFlake grows two things for this: hardwareProfile now also takes a list
(autodetection emits several common-* modules), and installed systems get
the standalone home-manager CLI from the pinned input. Unattended mode
(NOMARCHY_UNATTENDED=1 + env) documented in docs/TESTING.md §4.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
31
lib.nix
31
lib.nix
@@ -9,23 +9,28 @@
|
||||
mkFlake =
|
||||
{ src # the downstream flake directory (./.)
|
||||
, username # login name; also the homeConfigurations attr
|
||||
, hardwareProfile ? null # a nixos-hardware module name, or null
|
||||
, hardwareProfile ? null # nixos-hardware module name(s): string, list, or null
|
||||
, system ? "x86_64-linux"
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
hardwareModules =
|
||||
if hardwareProfile == null then
|
||||
[ ]
|
||||
else if builtins.hasAttr hardwareProfile nixos-hardware.nixosModules then
|
||||
[ nixos-hardware.nixosModules.${hardwareProfile} ]
|
||||
# One profile or several (the installer's autodetection emits a few
|
||||
# common-* modules alongside the model-specific one).
|
||||
profileNames =
|
||||
if hardwareProfile == null then [ ]
|
||||
else if builtins.isList hardwareProfile then hardwareProfile
|
||||
else [ hardwareProfile ];
|
||||
|
||||
lookupProfile = name:
|
||||
if builtins.hasAttr name nixos-hardware.nixosModules then
|
||||
nixos-hardware.nixosModules.${name}
|
||||
else
|
||||
throw ''
|
||||
nomarchy.lib.mkFlake: unknown hardwareProfile "${hardwareProfile}".
|
||||
nomarchy.lib.mkFlake: unknown hardwareProfile "${name}".
|
||||
${let
|
||||
close = builtins.filter
|
||||
(name: lib.strings.levenshteinAtMost 3 name hardwareProfile)
|
||||
(candidate: lib.strings.levenshteinAtMost 3 candidate name)
|
||||
(builtins.attrNames nixos-hardware.nixosModules);
|
||||
in
|
||||
lib.optionalString (close != [ ])
|
||||
@@ -37,6 +42,8 @@
|
||||
Omit hardwareProfile entirely if your machine has no profile.
|
||||
'';
|
||||
|
||||
hardwareModules = map lookupProfile profileNames;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ nomarchy.overlays.default ];
|
||||
@@ -49,7 +56,13 @@
|
||||
inherit system;
|
||||
specialArgs = { inherit username; };
|
||||
modules =
|
||||
[ nomarchy.nixosModules.nomarchy ]
|
||||
[
|
||||
nomarchy.nixosModules.nomarchy
|
||||
# The standalone HM CLI ships with the system so theme switching
|
||||
# (`nomarchy-theme-sync apply` → `home-manager switch`) works
|
||||
# out of the box — same pinned input as the desktop modules.
|
||||
{ environment.systemPackages = [ home-manager.packages.${system}.home-manager ]; }
|
||||
]
|
||||
++ hardwareModules
|
||||
++ [
|
||||
(src + "/hardware-configuration.nix") # from nixos-generate-config
|
||||
|
||||
Reference in New Issue
Block a user