Flakes UX: make it easy to evaluate an arbitrary expression in a context of a flake
This is a design discussion issue, so feel free to give as much feedback and criticism as you like. ## Preamble In ye olde days of `nix-shell`, it was possible to easily evaluate expressions in the context of `nixpkgs`. Something like this: ``` nix-shell -p 'python3.withPackages (ps: with ps; [ numpy scipy ])' ``` Drops you into a shell in which there's a `python3` executable with numpy and scipy available. This is really useful for ad-hoc scripting. You could also do something like ``` nix-shell -p 'hello.overrideAttrs (_: { src = ./.; })' ``` It was also possible to add `alias p='nix-shell -p'` to save some typing. The flexibility is endless -- and all just a few keystrokes away! ## Current situation It is possible to do something similar with new, flaky interface: ``` nix shell --impure --expr 'with builtins.getFlake "nixpkgs"; with legacyPackages.${builtins.currentPlatform}; python3.withPackages (ps: with ps; [ numpy scipy ])' ``` However, this is a chore to do, and I'd much rather just run `pip install numpy scipy` and deal with all the usual stateful package management issues than type this monstrosity every time I need to try a python package. ## Proposal Add a way to easily evaluate expressions "in the context of" a flake, meaning with the top-level attributes and `{packages,legacyPackages}.${currentPlatform}` of that flake available in scope. ### Possible implementations I came up with three different ideas, all of which have some advantages and drawbacks
Posted by balsoft on Nov 15, 2021, 3:16 PM
Tags
Related issues
- To be fair, Inform7 can't succeed, generally, because there is no market for the kind of games that you create with Inform7.
- > The notion that somehow LR reliability is misunderstood by Consumer Reports, JD Power, Car & Driver, Automobile etc.
- Custom trigger IDs are not displayed in the new 2026.10 trigger selector
- I hate that too, but I think it’s more the ux than the concept of a default.
- > The biggest problem with UX developers is they know better than you AND force you into their paradigm.
- "Focus follows mouse" is what I use to keep the file manager from popping up when click-dragging files.
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
ux (Other)
To be fair, Inform7 can't succeed, generally, because there is no market for the kind of games that you create with Inform7.
New> The notion that somehow LR reliability is misunderstood by Consumer Reports, JD Power, Car & Driver, Automobile etc.
Custom trigger IDs are not displayed in the new 2026.10 trigger selector
I hate that too, but I think it’s more the ux than the concept of a default.
> The biggest problem with UX developers is they know better than you AND force you into their paradigm.
"Focus follows mouse" is what I use to keep the file manager from popping up when click-dragging files.
The biggest problem with this is if the target URL doesn't load but also doesn't quickly error out, like e.g.
Google wants to build up a private web here.
Flakes UX: make it easy to evaluate an arbitrary expression in a context of a flake
This is a design discussion issue, so feel free to give as much feedback and criticism as you like. ## Preamble In ye olde days of `nix-shell`, it was possible to easily evaluate expressions in the context of `nixpkgs`. Something like this: ``` nix-shell -p 'python3.withPackages (ps: with ps; [ numpy scipy ])' ``` Drops you into a shell in which there's a `python3` executable with numpy and scipy available. This is really useful for ad-hoc scripting. You could also do something like ``` nix-shell -p 'hello.overrideAttrs (_: { src = ./.; })' ``` It was also possible to add `alias p='nix-shell -p'` to save some typing. The flexibility is endless -- and all just a few keystrokes away! ## Current situation It is possible to do something similar with new, flaky interface: ``` nix shell --impure --expr 'with builtins.getFlake "nixpkgs"; with legacyPackages.${builtins.currentPlatform}; python3.withPackages (ps: with ps; [ numpy scipy ])' ``` However, this is a chore to do, and I'd much rather just run `pip install numpy scipy` and deal with all the usual stateful package management issues than type this monstrosity every time I need to try a python package. ## Proposal Add a way to easily evaluate expressions "in the context of" a flake, meaning with the top-level attributes and `{packages,legacyPackages}.${currentPlatform}` of that flake available in scope. ### Possible implementations I came up with three different ideas, all of which have some advantages and drawbacks
Comments (0)
No comments yet. Start the discussion.