Open sg-qwt opened 1 year ago
Slightly related: is there a way to print defined variables?
what's added by nix repl .#
diff nothing.txt replflake.txt | grep \>
> devShells
> legacyPackages
> nixosConfigurations
> overlays
> packages
what's additionally loaded by :lf
diff replflake.txt lf.txt | grep \>
> _type
> inputs
> lastModified
> lastModifiedDate
> narHash
> outPath
> outputs
> sourceInfo
> submodules
The nix \<flake>#\<attribute> argument apparently only supports the output attributes, so maybe it would make sense to make all nix commands support these attributes too, not just the output attributes. For example, then you could run
nix build .#inputs.nixpkgs.hello
to build hello from the nixpkgs input of the flake.
This workaround loads all the same attributes as :lf
with nix repl .#
, but some commands show the "unknown" attributes
{
outputs = { self, ... }: {
inherit (self) _type inputs lastModified lastModifiedDate narHash outPath outputs sourceInfo submodules;
};
}
Discussed during the Nix maintainers meeting on 2024-02-26.
nix repl <flakeref>
align with :lf
.This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2024-02-28-nix-team-meeting-129/40499/1
@asymmetric:
Slightly related: is there a way to print defined variables?
you can use functions like trace
(from builtins/lib).
@mvnetbiz:
what's additionally loaded by
:lf
actually, lib
differs between the two as well - for :lf
it seems to also have stuff like lib.nixosSystem
actually,
lib
differs between the two as well - for:lf
it seems to also have stuff likelib.nixosSystem
Do you mean that nix repl nixpkgs
doesn't give you lib.nixosSystem
?
$ nix repl nixpkgs
Nix 2.21.0pre20240304_4388559
Type :? for help.
Loading installable 'flake:nixpkgs#'...
Added 5 variables.
nix-repl> lib.nixosSystem
«lambda nixosSystem @ /nix/store/3i3rncs75fid9hwai5p2nvwc4ngdnia7-source/flake.nix:21:23»
Not sure of this is a bug or desired behavior of the new experimental repl-flake.
With repl-flake enabled and entered my nixos flake, when I run
nix repl .#
, only 5 variables added. In my previous workflow with:lf
inside repl, I can see more variables added. Things like input etc are missing bynix repl .#