mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 19:47:37 +01:00
shell.nix: Support nix-shell -A
It used to be that `nix-shell -A hello` would launch the build shell for the `hello` package. By adding `/shell.nix`, that stopped working, as all versions of `nix-shell` resolve the unspecified file to `$PWD/shell.nix` if it exists, and now it does. I have to admit that this use of `//` is not pretty, but the UX/DX hard to match.
This commit is contained in:
parent
6b2e0aae78
commit
5407a105c8
1 changed files with 10 additions and 1 deletions
11
shell.nix
11
shell.nix
|
@ -17,8 +17,17 @@
|
|||
}:
|
||||
let
|
||||
inherit (import ./ci { inherit nixpkgs system; }) pkgs;
|
||||
|
||||
# For `nix-shell -A hello`
|
||||
curPkgs = builtins.removeAttrs (import ./. { inherit system; }) [
|
||||
# Although this is what anyone may expect from a `_type = "pkgs"`,
|
||||
# this file is intended to produce a shell in the first place,
|
||||
# and a `_type` tag could confuse some code.
|
||||
"_type"
|
||||
];
|
||||
in
|
||||
pkgs.mkShellNoCC {
|
||||
curPkgs
|
||||
// pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
# The default formatter for Nix code
|
||||
# See https://github.com/NixOS/nixfmt
|
||||
|
|
Loading…
Reference in a new issue