Fediversity/deployment/check/data-model/deployment.nix
Kiara Grouwstra ccf442b099
reproduce infinite recursion
the challenge here seems to stem from a mutual dependency between imports and `inputs`:

```
  at /nix/store/zid48nap5bh52n8d2gc5kbnzhxy3cm0k-source/deployment/data-model.nix:31:7:
    30|     staticModules = [
    31|       inputs.nixops4.modules.nixops4Deployment.default
      |       ^
    32|
… while calling anonymous lambda
  at /nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source/lib/modules.nix:513:35:
   512|       context = name: ''while evaluating the module argument `${name}' in "${key}":'';
   513|       extraArgs = mapAttrs (name: _:
      |                                   ^
   514|         addErrorContext (context name)
… while evaluating the module argument `inputs' in "/nix/store/zid48nap5bh52n8d2gc5kbnzhxy3cm0k-source/deployment/data-model.nix":
… while evaluating the attribute 'inputs'
  at /nix/store/zid48nap5bh52n8d2gc5kbnzhxy3cm0k-source/deployment/check/data-model/deployment.nix:15:17:
    14|       specialArgs = {
    15|         inherit inputs;
      |                 ^
    16|       };
… from call site
  at /nix/store/zid48nap5bh52n8d2gc5kbnzhxy3cm0k-source/deployment/check/data-model/deployment.nix:15:17:
    14|       specialArgs = {
    15|         inherit inputs;
      |                 ^
    16|       };
```
2025-08-01 20:38:43 +02:00

61 lines
1.5 KiB
Nix

{
inputs,
sources,
lib,
...
}:
let
inherit (import ./constants.nix) targetMachines pathToRoot pathFromRoot;
eval =
module:
(lib.evalModules {
specialArgs = {
inherit inputs;
};
modules = [
module
../../data-model.nix
];
}).config;
fediversity = eval (
{ ... }:
{
config = {
environments.single-nixos-vm =
{ ... }:
{
implementation = requests: {
input = requests;
output =
{ providers, ... }:
{
providers = {
inherit (inputs.nixops4.modules.nixops4Provider) local;
};
resources = lib.genAttrs targetMachines (nodeName: {
type = providers.local.exec;
imports = [
inputs.nixops4-nixos.modules.nixops4Resource.nixos
../../data-model.nix
../../function.nix
../common/targetResource.nix
];
_module.args = { inherit inputs sources; };
inherit nodeName pathToRoot pathFromRoot;
nixos.module =
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.${nodeName} ];
};
});
};
};
};
};
}
);
in
fediversity.environments.single-nixos-vm.deployment {
enable = true;
}