feat: nomarchy.lib.mkFlake — one-call downstream wrapper + hardware profiles

Downstream users now own only system.nix and home.nix; their flake.nix is
generated once from the template and never hand-edited. mkFlake (lib.nix)
wires both layers and maps hardwareProfile = "<name>" to nixos-hardware
modules (new input, pinned here, nixpkgs follows ours; unknown names fail
with did-you-mean suggestions). Flake checks evaluate the template through
mkFlake — including a real profile — so drift fails `nix flake check`.

Also from the live-VM testing session: install the home-manager CLI in the
live ISO and pin flake inputs transitively (offline theme switching needs
stylix's own inputs too), plus swww→awww doc updates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-06-10 15:38:57 +01:00
parent 8a0ec763e0
commit 1f22e996dc
9 changed files with 557 additions and 67 deletions

View File

@@ -1,53 +1,20 @@
{
description = "My Nomarchy machine";
inputs = {
# Pin Nomarchy; nixpkgs and home-manager follow whatever it ships.
nomarchy.url = "github:YOUR-USER/nomarchy"; # <- point at the distro repo
nixpkgs.follows = "nomarchy/nixpkgs";
home-manager.follows = "nomarchy/home-manager";
};
# The only input. nixpkgs, home-manager etc. come pinned through it —
# tested together upstream. This file is written once (by you or the
# installer) and never hand-edited afterwards; your machine lives in
# system.nix and home.nix.
inputs.nomarchy.url = "github:YOUR-USER/nomarchy"; # <- the distro repo
outputs = { self, nomarchy, nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
outputs = { nomarchy, ... }:
nomarchy.lib.mkFlake {
src = ./.;
username = "me"; # <- your login name
pkgs = import nixpkgs {
inherit system;
overlays = [ nomarchy.overlays.default ];
};
in
{
# System layer — rebuilt rarely:
# sudo nixos-rebuild switch --flake .#default
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
nomarchy.nixosModules.nomarchy # the distro
./hardware-configuration.nix # from `nixos-generate-config`
./system.nix # your machine
];
};
# Desktop layer — rebuilt on every theme change, no sudo:
# home-manager switch --flake .#me
# (`nomarchy-theme-sync apply <theme>` runs this for you.)
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
nomarchy.homeModules.nomarchy
./home.nix
{
# Your theme state — written by nomarchy-theme-sync, baked
# in on every switch. Keep it git-tracked.
nomarchy.stateFile = ./theme-state.json;
home = {
inherit username;
homeDirectory = "/home/${username}";
};
}
];
};
# Optional: a nixos-hardware module name for your machine, e.g.
# hardwareProfile = "framework-13-7040-amd";
# Names: https://github.com/NixOS/nixos-hardware
# (the future installer fills this in automatically from DMI data)
};
}