Skip to content

colmena repl fails when used with direct flake evaluation. #287

@kivikakk

Description

@kivikakk

Hi! I am giving Colmena a try. colmena repl doesn't appear to work with direct flake evaluation.

With an ~empty colmenaHive definition in my flake.nix:

colmenaHive = colmena.lib.makeHive {};

(I had more going, but I kept removing parts until I was satisfied the error wasn't related!)

colmena repl results in:

$ ../colmena/target/debug/colmena repl
warning: Git tree '/Users/kivikakk/g/vyxos' is dirty
[INFO ] Using flake: git+file:///Users/kivikakk/g/vyxos
warning: Git tree '/Users/kivikakk/g/vyxos' is dirty
warning: will not write lock file of flake 'path:/private/var/folders/92/4t85zvr910d4qtnfnv06qn740000gn/T/colmena-assets-oGVFCw' because it has an unlocked input ('git+file:///Users/kivikakk/g/vyxos')
Nix 2.24.12
Type :? for help.
Loading installable ''...
error:
       … while evaluating an attribute set to be merged in the global scope
         at /var/folders/92/4t85zvr910d4qtnfnv06qn740000gn/T/colmena-repl-Tasu50.nix:1:16:
       error: expected a set but found a function: «lambda @ /var/folders/92/4t85zvr910d4qtnfnv06qn740000gn/T/colmena-repl-Tasu50.nix:1:16»
[ERROR] -----
[ERROR] Operation failed with error: Child process exited with error code: 1
Backtrace:
[…]

I'm using my own build of df694ee to help me debug, but there's no modifications in this invocation.

I've dumped the Command executed by colmena repl:

Command { std: "nix" "repl" "--experimental-features" "nix-command flakes" "--file" "/var/folders/92/4t85zvr910d4qtnfnv06qn740000gn/T/colmena-repl-m2UqVE.nix", kill_on_drop: false }

And the content of the generated file:

with builtins; hive: assert (hive.__schema == "v0.5" || throw ''
    The colmenaHive output (schema ${hive.__schema}) isn't compatible with this version of Colmena.

    Hint: Use the same version of Colmena as in the Flake input.
'');  hive.introspect (x: x)

There's no reference to the flake in cwd here; I assume that's because FLAKE_APPLY_SNIPPET (which is the exact content of the file written out, above) is intended to be evaluated in the context of a flake in an invocation like nix eval .#colmenaHive --apply [EXPR].


Anyway, I guess all this isn't super necessary, since nix repl . and accessing colmenaHive.nodes directly seems to work! I should've tried that first, maybe. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions