REPL does not insert inputs or self of a flake into the environment #771

Open
opened 2025-03-26 17:44:11 +00:00 by jade · 1 comment
Owner

Currently there's no way to examine the inputs of a flake or its self value in the REPL. This makes debugging flakes suck.

I am not 100% sure the way it should work because injecting them directly would potentially lead one to think that they are part of outputs, which is how the repl currently works. Consequently I have a habit of writing flakes which export self since this sucks.

I was today years old when I realized this is actually that nix repl sucks, and we can fix it.

lix/lix3 » nix repl .
Lix 2.93.0-dev-pre20250324-4181796
Type :? for help.
Loading installable 'git+file:///Users/jade/lix/lix3#'...
Added 8 variables.
nix-repl> :env
Env level 0
static: checks devShells hydraJobs overlays packages release-jobs releaseTests self 

Env level 1
abort baseNameOf break builtins derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML im
port isNull map null placeholder removeAttrs scopedImport throw toString true 

For reference, note that self is there. That got there because jade put it there.

Currently there's no way to examine the inputs of a flake or its `self` value in the REPL. This makes debugging flakes suck. I am not 100% sure the way it *should* work because injecting them directly would potentially lead one to think that they are part of `outputs`, which is how the repl currently works. Consequently I have a habit of writing flakes which export `self` since this sucks. I was today years old when I realized this is actually that `nix repl` sucks, and we can fix it. ``` lix/lix3 » nix repl . Lix 2.93.0-dev-pre20250324-4181796 Type :? for help. Loading installable 'git+file:///Users/jade/lix/lix3#'... Added 8 variables. nix-repl> :env Env level 0 static: checks devShells hydraJobs overlays packages release-jobs releaseTests self Env level 1 abort baseNameOf break builtins derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML im port isNull map null placeholder removeAttrs scopedImport throw toString true ``` For reference, note that `self` is there. That got there because [jade put it there](https://git.lix.systems/lix-project/lix/src/2491b7cc2128ee440d24768c4521c38b1859fc28/flake.nix#L227-L228).
Owner

Funnily, :lf . would give you inputs I think, such a strange different behavior… !

Funnily, `:lf .` would give you `inputs` I think, such a strange different behavior… !
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#771
No description provided.