| 22 Oct 2022 |
roshan | byteio.in 🌷 | how can i pass different key for each host in colmena ? | 04:45:23 |
@palo:xaos.space | In reply to @ronixx:matrix.org how can i pass different key for each host in colmena ? maybe use ~/.ssh/config to configure which hosts should use which key. Or is ssh-ng ignoring that? | 12:43:19 |
| @sofo:matrix.org joined the room. | 17:00:09 |
| 23 Oct 2022 |
David Arnold (blaggacao) | Hi Zhaofeng Li !
I beleive colmena eval was only ever made to be impure (so the --impure option might be a mistake), see:
introspect = f:
f {
lib = nixpkgs.lib // builtins;
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem};
nodes = l.mapAttrs (evalNode {_module.check = false;}) comb;
};
| 02:30:42 |
David Arnold (blaggacao) | * Hi Zhaofeng Li !
I beleive colmena eval was only ever made to be impure (so the --impure option might be a mistake), see builtins.currentSystem in:
introspect = f:
f {
lib = nixpkgs.lib // builtins;
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem};
nodes = l.mapAttrs (evalNode {_module.check = false;}) comb;
};
| 02:30:57 |
David Arnold (blaggacao) | Or am I missing something? | 02:31:38 |
David Arnold (blaggacao) | So I made use of the new colmenaHive output 🦾
That's a super nice iface, imo.
- make honey: https://github.com/divnix/hive/blob/main/make-honey.nix
- fill it in the jar: https://github.com/divnix/hive/blob/d7119b1d5d1fd6f88c2d0c051c1512ff0edaa91f/flake.nix#L78-L84
- pollen: https://github.com/divnix/hive/blob/d7119b1d5d1fd6f88c2d0c051c1512ff0edaa91f/comb/_QUEEN/colmenaConfigurations.nix#L8-L21
| 06:29:48 |
David Arnold (blaggacao) | What I do not understand as much as I try, is why I get an infinit recursion when I try to freeformType evaluate the entire configuration, including all imports. https://github.com/divnix/hive/blob/main/make-honey.nix#L83-L85 | 15:45:23 |
Linux Hackerman | In reply to @blaggacao:matrix.org What I do not understand as much as I try, is why I get an infinit recursion when I try to freeformType evaluate the entire configuration, including all imports. https://github.com/divnix/hive/blob/main/make-honey.nix#L83-L85 Probably because options depends on imports | 15:47:12 |
David Arnold (blaggacao) | What I did is I already used a custom assertion implementation under config.erased to avoid most part.of that | 15:48:23 |
David Arnold (blaggacao) | * What I did is I already used a custom assertion implementation under `config.erased` to avoid most part of that | 15:48:30 |
David Arnold (blaggacao) | But it seems like the check = true; still want's to eagerly check all options and definitions. Even though the freeformType is undefined (amd should neither check anything, nor merge). | 15:49:41 |
David Arnold (blaggacao) | I even tried to replicate the "sink" type (which btw seems broken upstream), explicitly muting the merge function. | 15:50:20 |
David Arnold (blaggacao) | * But it seems like the `check = true;` still want's to eagerly check all options and definitions. Even though the freeformType is `undefined` (and should neither check anything, nor merge). | 15:50:42 |
David Arnold (blaggacao) | Or maybe you mean something else than what I understood? | 15:55:43 |
David Arnold (blaggacao) | In the unlikely event that somebody is keen on helping with an infinite recursion, here are the neuralgic points of the trace:
at /nix/store/gv1gp6l2gqgf7j6fpswbcdsr6yi395xy-source/make-honey.nix:123:34:
122| (l.mapAttrs (machine: checkAndTransformConfig user machine))
123| (l.filterAttrs (_: config: config.nixpkgs.system == system))
| ^
124| (l.mapAttrs (machine: l.nameValuePair "${user}-o-${machine}"))
[...]
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:751:121:
750| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
751| in throw "A definition for option `${showOption loc}' is not of type `${type.description}'. Definition values:${showDefs allInvalid}"
| ^
752| else
… while evaluating the attribute 'mergedValue'
[ ... ]
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/options.nix:342:10:
341| prettyEval = builtins.tryEval
342| (lib.generators.toPretty { }
| ^
343| (lib.generators.withRecursion { depthLimit = 10; throwOnDepthLimit = false; } def.value));
… while evaluating anonymous lambda
[ ... ]
error: attribute 'pkgs' missing
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:467:28:
466| builtins.addErrorContext (context name)
467| (args.${name} or config._module.args.${name})
| ^
468| ) (lib.functionArgs f);
… while evaluating the module argument `pkgs' in "/nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/nixos/modules/profiles/installation-device.nix":
… while evaluating anonymous lambda
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:465:44:
464| context = name: ''while evaluating the module argument `${name}' in "${key}":'';
465| extraArgs = builtins.mapAttrs (name: _:
| ^
466| builtins.addErrorContext (context name)
… from call site
… while evaluating 'id'
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/trivial.nix:14:5:
13| # The value to return
14| x: x;
| ^
15|
… from call site
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/generators.nix:272:47:
271| let
272| evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
| ^
273| in
… while evaluating anonymous lambda
| 16:11:28 |
David Arnold (blaggacao) | * In the unlikely event that somebody is keen on helping with an infinite recursion, here are the neuralgic points of the trace (in reverse order):
at /nix/store/gv1gp6l2gqgf7j6fpswbcdsr6yi395xy-source/make-honey.nix:123:34:
122| (l.mapAttrs (machine: checkAndTransformConfig user machine))
123| (l.filterAttrs (_: config: config.nixpkgs.system == system))
| ^
124| (l.mapAttrs (machine: l.nameValuePair "${user}-o-${machine}"))
[...]
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:751:121:
750| else let allInvalid = filter (def: ! type.check def.value) defsFinal;
751| in throw "A definition for option `${showOption loc}' is not of type `${type.description}'. Definition values:${showDefs allInvalid}"
| ^
752| else
… while evaluating the attribute 'mergedValue'
[ ... ]
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/options.nix:342:10:
341| prettyEval = builtins.tryEval
342| (lib.generators.toPretty { }
| ^
343| (lib.generators.withRecursion { depthLimit = 10; throwOnDepthLimit = false; } def.value));
… while evaluating anonymous lambda
[ ... ]
error: attribute 'pkgs' missing
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:467:28:
466| builtins.addErrorContext (context name)
467| (args.${name} or config._module.args.${name})
| ^
468| ) (lib.functionArgs f);
… while evaluating the module argument `pkgs' in "/nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/nixos/modules/profiles/installation-device.nix":
… while evaluating anonymous lambda
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:465:44:
464| context = name: ''while evaluating the module argument `${name}' in "${key}":'';
465| extraArgs = builtins.mapAttrs (name: _:
| ^
466| builtins.addErrorContext (context name)
… from call site
… while evaluating 'id'
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/trivial.nix:14:5:
13| # The value to return
14| x: x;
| ^
15|
… from call site
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/generators.nix:272:47:
271| let
272| evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
| ^
273| in
… while evaluating anonymous lambda
| 16:11:45 |
David Arnold (blaggacao) | Above all, this looks like a boundary violation of lib.evalModules itself, which appears to depend on pkgs, but without ensuring it. | 16:12:30 |
David Arnold (blaggacao) | * Above all, this looks like a boundary violation of lib.evalModules itself, which appears to depend on pkgs, but without apparently ensuring its presence. | 16:12:49 |
David Arnold (blaggacao) | ... or maby that's rather a side offect of wanting to eval a particular module, whithout (me) ensuring said contract, but as soon as I add something reasonable as pkgs, I get an infinite recursion. | 16:13:55 |
David Arnold (blaggacao) | error: infinite recursion encountered
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:712:9:
711| in warnDeprecation opt //
712| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
713| inherit (res.defsFinal') highestPrio;
(use '--show-trace' to show detailed location information)
| 16:15:37 |
David Arnold (blaggacao) | coming somewhere from there:
at /nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/lib/modules.nix:728:137:
727| defs' = concatMap (m:
728| map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
729| ) defs;
… while evaluating definitions from `/nix/store/5y5ndnbgvv6mfknnxv48v1swznc5g6wx-source/nixos/modules/installer/cd-dvd/installation-cd-base.nix':
| 16:17:22 |
David Arnold (blaggacao) | (modules/installer/cd-dvd/installation-cd-base.nix) | 16:17:37 |
David Arnold (blaggacao) | I think I found it, regular modules accessing config.system is recursive... | 16:40:04 |
David Arnold (blaggacao) |  Download image.png | 17:23:55 |
David Arnold (blaggacao) | Zhaofeng Li: the streaming evaluator shows this warning (--gc-roots-dir) (fysa) | 17:24:05 |
David Arnold (blaggacao) | And this fixed my above problem 😄 https://github.com/divnix/hive/commit/e1baaaec17524abb5cc00377082cebe8d738a238 | 17:24:53 |
David Arnold (blaggacao) | * And this fixed my above problem 😄 https://github.com/divnix/hive/commit/f532568755835426047a60ca215b764480b10e57 | 17:25:56 |
Zhaofeng Li | In reply to @blaggacao:matrix.org
Hi Zhaofeng Li !
I beleive colmena eval was only ever made to be impure (so the --impure option might be a mistake), see builtins.currentSystem in:
introspect = f:
f {
lib = nixpkgs.lib // builtins;
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem};
nodes = l.mapAttrs (evalNode {_module.check = false;}) comb;
};
Hmm, could you link the code? The current implementation is: https://github.com/zhaofengli/colmena/blob/956c3363b875695fba30a5a8033dc543c2cd4326/src/nix/hive/eval.nix#L193 | 20:08:18 |
Zhaofeng Li | Ah, it's in your make-honey.nix, missed it. But the options should be passed correctly and there is no --impure:
$ colmena eval -E '{...}: builtins.currentSystem'
warning: Git tree '/home/zhaofeng/Git/fleet' is dirty
[INFO ] Using flake: git+file:///home/zhaofeng/Git/fleet?dir=nix
error: attribute 'currentSystem' missing
| 20:14:46 |