forked from Fediversity/Fediversity
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| }; ```
This commit is contained in:
parent
6635a11832
commit
ccf442b099
3 changed files with 56 additions and 29 deletions
|
@ -2,35 +2,60 @@
|
||||||
inputs,
|
inputs,
|
||||||
sources,
|
sources,
|
||||||
lib,
|
lib,
|
||||||
providers,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (import ./constants.nix) targetMachines pathToRoot pathFromRoot;
|
inherit (import ./constants.nix) targetMachines pathToRoot pathFromRoot;
|
||||||
in
|
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 = {
|
providers = {
|
||||||
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
||||||
};
|
};
|
||||||
|
|
||||||
resources = lib.genAttrs targetMachines (nodeName: {
|
resources = lib.genAttrs targetMachines (nodeName: {
|
||||||
type = providers.local.exec;
|
type = providers.local.exec;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
||||||
|
../../data-model.nix
|
||||||
|
../../function.nix
|
||||||
../common/targetResource.nix
|
../common/targetResource.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
_module.args = { inherit inputs sources; };
|
_module.args = { inherit inputs sources; };
|
||||||
|
|
||||||
inherit nodeName pathToRoot pathFromRoot;
|
inherit nodeName pathToRoot pathFromRoot;
|
||||||
|
|
||||||
nixos.module =
|
nixos.module =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
environment.systemPackages = [ pkgs.${nodeName} ];
|
environment.systemPackages = [ pkgs.${nodeName} ];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
fediversity.environments.single-nixos-vm.deployment {
|
||||||
|
enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
inputs.nixops4.modules.flake.default
|
inputs.nixops4.modules.flake.default
|
||||||
];
|
];
|
||||||
|
|
||||||
nixops4Deployments.check-deployment-basic = {
|
nixops4Deployments.check-deployment-model = {
|
||||||
imports = [ ./deployment/check/basic/deployment.nix ];
|
imports = [ ./deployment/check/data-model/deployment.nix ];
|
||||||
_module.args = { inherit inputs sources; };
|
_module.args = { inherit inputs sources; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
{
|
{
|
||||||
_class = "nixosTest";
|
_class = "nixosTest";
|
||||||
|
|
||||||
name = "deployment-basic";
|
name = "deployment-model";
|
||||||
|
|
||||||
sourceFileset = lib.fileset.unions [
|
sourceFileset = lib.fileset.unions [
|
||||||
|
../../data-model.nix
|
||||||
|
../../function.nix
|
||||||
./constants.nix
|
./constants.nix
|
||||||
./deployment.nix
|
./deployment.nix
|
||||||
];
|
];
|
||||||
|
@ -39,7 +41,7 @@
|
||||||
cowsay.fail("cowsay 1>&2")
|
cowsay.fail("cowsay 1>&2")
|
||||||
|
|
||||||
with subtest("Run the deployment"):
|
with subtest("Run the deployment"):
|
||||||
deployer.succeed("nixops4 apply check-deployment-basic --show-trace --no-interactive 1>&2")
|
deployer.succeed("nixops4 apply check-deployment-model --show-trace --no-interactive 1>&2")
|
||||||
|
|
||||||
with subtest("Check the deployment"):
|
with subtest("Check the deployment"):
|
||||||
hello.succeed("hello 1>&2")
|
hello.succeed("hello 1>&2")
|
||||||
|
|
Loading…
Add table
Reference in a new issue