diff --git a/tests/networkd-phobos.nix b/tests/networkd-phobos.nix index 4b8513b..8b67d6c 100644 --- a/tests/networkd-phobos.nix +++ b/tests/networkd-phobos.nix @@ -2,40 +2,49 @@ let system = "x86_64-linux"; + # Bring in nixpkgs and lib pkgs = import { inherit system; }; lib = pkgs.lib; + # Your world + addressing lib meta = import ../meta.nix; addressing = import ../lib/addressing { inherit lib; }; - nixos = lib.nixosSystem { - inherit system; + # NixOS module system library + nixosLib = import { + inherit lib; + }; - modules = [ - # Your core Metanix module (the one you moved) - ../modules/metanix/core.nix + # All standard NixOS modules (as a list) + baseModules = import ; - # The systemd-networkd integration you pasted - ../modules/metanix/networkd.nix + # Evaluate modules as if this were a NixOS system + evalResult = nixosLib.evalModules { + modules = + baseModules + ++ [ + # Metanix core wiring (meta + addressing) + ../modules/metanix/core.nix - # Inline module to wire meta/addressing + identify this host - { - # Metanix world & library - inherit meta addressing; + # systemd-networkd integration + ../modules/metanix/networkd.nix - # Who am I? - networking.hostName = "phobos"; - # Optional override; here it matches hostName anyway - metanix.thisHost = "phobos"; + # Local stub: "this machine is phobos" + { + networking.hostName = "phobos"; + metanix.thisHost = "phobos"; + } + ]; - # You can also stub other things here if needed - } - ]; + # Args passed to all modules: { lib, pkgs, system, meta, addressing, modulesPath, ... } + specialArgs = { + inherit lib pkgs system meta addressing; + modulesPath = builtins.toString ; + }; }; in { - # What we care about inspecting: - systemdNetwork = nixos.config.systemd.network; - metanixHost = nixos.config.metanix.network.hosts.phobos; - metanixSubnet = nixos.config.metanix.network.subnets."home-main"; + systemdNetwork = evalResult.config.systemd.network; + metanixHost = evalResult.config.metanix.network.hosts.phobos; + metanixSubnet = evalResult.config.metanix.network.subnets."home-main"; }