Fediversity/deployment/check/data-model/nixosTest.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

50 lines
1.1 KiB
Nix

{ inputs, lib, ... }:
{
_class = "nixosTest";
name = "deployment-model";
sourceFileset = lib.fileset.unions [
../../data-model.nix
../../function.nix
./constants.nix
./deployment.nix
];
nodes.deployer =
{ pkgs, ... }:
{
environment.systemPackages = [
inputs.nixops4.packages.${pkgs.system}.default
];
# FIXME: sad times
system.extraDependencies = with pkgs; [
jq
jq.inputDerivation
];
system.extraDependenciesFromModule =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
hello
cowsay
];
};
};
extraTestScript = ''
with subtest("Check the status before deployment"):
hello.fail("hello 1>&2")
cowsay.fail("cowsay 1>&2")
with subtest("Run the deployment"):
deployer.succeed("nixops4 apply check-deployment-model --show-trace --no-interactive 1>&2")
with subtest("Check the deployment"):
hello.succeed("hello 1>&2")
cowsay.succeed("cowsay hi 1>&2")
'';
}