Finally
This commit is contained in:
parent
62899898fe
commit
8b2042e2bd
2 changed files with 43 additions and 18 deletions
|
|
@ -2,17 +2,28 @@
|
|||
let
|
||||
system = "x86_64-linux";
|
||||
|
||||
# Grab nixpkgs lib for convenience
|
||||
# Real nixpkgs for addressing lib
|
||||
pkgs = import <nixpkgs> { inherit system; };
|
||||
lib = pkgs.lib;
|
||||
realLib = pkgs.lib;
|
||||
|
||||
# Metanix world + addressing
|
||||
# Minimal "testing lib" that makes mkIf actually behave like a real if
|
||||
testLib = realLib // {
|
||||
mkOption = x: x;
|
||||
mkIf = cond: body: if cond then body else { };
|
||||
|
||||
types = {
|
||||
str = "str";
|
||||
nullOr = t: "nullOr " + builtins.toString t;
|
||||
};
|
||||
};
|
||||
|
||||
# Your world + addressing lib
|
||||
meta = import ../meta.nix;
|
||||
addressing = import ../lib/addressing { inherit lib; };
|
||||
addressing = import ../lib/addressing { lib = realLib; };
|
||||
|
||||
network = addressing.mkNetworkFromSpec meta;
|
||||
|
||||
# Fake NixOS config that your module expects
|
||||
# Fake NixOS config for this test
|
||||
config = {
|
||||
networking.hostName = "phobos";
|
||||
metanix = {
|
||||
|
|
@ -21,16 +32,18 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
# Call the networkd module directly as a function
|
||||
# Call the Metanix networkd module with the fake lib + config
|
||||
networkdModule = import ../modules/metanix/networkd.nix {
|
||||
inherit lib config;
|
||||
lib = testLib;
|
||||
inherit config;
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
# Raw Metanix view
|
||||
# Raw Metanix view for sanity
|
||||
metanixHost = network.hosts.phobos;
|
||||
metanixSubnet = network.subnets."home-main";
|
||||
|
||||
# What the module actually emits
|
||||
# What the module actually emits once mkIf is forced
|
||||
systemdNetwork = networkdModule.config.systemd.network;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue