From 1e2677c5439701335bc7860c9923100b3a2551bf Mon Sep 17 00:00:00 2001 From: Padreug Date: Sun, 28 Jun 2026 10:22:37 +0200 Subject: [PATCH] feat(flake): expose nixosModules.omnixy core aggregate Extract the reusable core module list into modules/default.nix (single source of truth) and expose it as nixosModules.omnixy / .default. configuration.nix now imports ./modules instead of listing each module, so this repo's hosts and external consumers share one definition. Theme stays a settings.theme-driven import inside the aggregate. Packs, dev-env, sops and home-manager remain injected by mkSystem. Co-Authored-By: Claude Opus 4.8 --- configuration.nix | 30 ++++++++-------------------- flake.nix | 12 ++++++++++++ modules/default.nix | 48 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 modules/default.nix diff --git a/configuration.nix b/configuration.nix index 7b72523..65768b1 100644 --- a/configuration.nix +++ b/configuration.nix @@ -15,28 +15,14 @@ let in { imports = [ - # NOTE: hardware-configuration.nix is imported per-host from - # hosts//default.nix (it's machine-specific), not here. - - # Omnixient modules - ./modules/lib.nix - ./modules/core.nix - ./modules/colors.nix - ./modules/boot.nix - ./modules/security.nix - ./modules/secrets.nix - ./modules/fastfetch.nix - ./modules/walker.nix - ./modules/scripts.nix - ./modules/menus.nix - ./modules/desktop/hyprland.nix - ./modules/packages.nix - ./modules/development.nix - ./modules/mcp.nix - ./modules/themes/${currentTheme}.nix - ./modules/users.nix - ./modules/services.nix - ./modules/hardware + # Omnixient core module aggregate (modules/default.nix) — the same set + # exposed as nixosModules.omni for external consumers, so there's a + # single source of truth for the core module list. The active theme + # is selected inside it from settings.theme. + # + # hardware-configuration.nix is imported per-host from + # hosts//default.nix (machine-specific), not here. + ./modules ]; # --- Per-host settings (edit these) --- diff --git a/flake.nix b/flake.nix index a16e708..15a05df 100644 --- a/flake.nix +++ b/flake.nix @@ -311,6 +311,18 @@ # / bitcoin packs are standalone-importable — usable on a non-omni # NixOS without enabling omni core. nixosModules = { + # Omnixient core, as a single importable module. A consumer using + # this flake as an input builds a host with: + # omni.lib.mkSystem "myhost" { + # settings = { ... }; + # modules = [ omni.nixosModules.omni ./hosts/myhost ]; + # }; + # mkSystem also injects packs + home-manager; this provides the + # desktop/system core (option namespace + behavior). Theme is + # chosen from settings.theme. + omni = import ./modules; + default = import ./modules; + lnbits = import ./modules/packs/lnbits.nix; aiolabs = import ./modules/packs/aiolabs.nix; bitcoin = import ./modules/packs/bitcoin.nix; diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..c05a6ed --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,48 @@ +# Omnixient core module aggregate. +# +# The reusable Omnixient module set as a single importable module, used from +# one source of truth in two places: +# - configuration.nix imports it for this repo's own hosts; +# - it's exposed as `nixosModules.omni` (flake.nix) so an external +# consumer can `imports = [ omni.nixosModules.omni ]` from their +# own flake without forking. +# +# Deliberately NOT here: +# - modules/packs and modules/dev-env — injected separately by +# lib/mksystem.nix (packs unconditionally, dev-env opt-in); +# - hardware-configuration.nix — per-host; +# - the sops-nix / home-manager modules — injected by mkSystem. +# +# The active theme is selected from `settings.theme` (a specialArg +# provided by mkSystem), matching the prior configuration.nix behavior. +{ + imports = [ + ./lib.nix + ./core.nix + ./colors.nix + ./boot.nix + ./security.nix + ./secrets.nix + ./fastfetch.nix + ./walker.nix + ./scripts.nix + ./menus.nix + ./desktop/hyprland.nix + ./packages.nix + ./development.nix + ./mcp.nix + ./users.nix + ./services.nix + ./hardware + + # Theme: import the colorscheme module named by settings.theme. Kept + # as a settings-driven dynamic import (rather than importing all 12 + # and guarding each) so the closure stays minimal. + ( + { settings, ... }: + { + imports = [ ./themes/${settings.theme}.nix ]; + } + ) + ]; +}