lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

mkShell: introduce packages argument (#122180)

The distinction between the inputs doesn't really make sense in the
mkShell context. Technically speaking, we should be using the
nativeBuildInputs most of the time.

So in order to make this function more beginner-friendly, add "packages"
as an attribute, that maps to nativeBuildInputs.

This commit also updates all the uses in nixpkgs.

authored by zimbatm.tngl.sh and committed by

GitHub c6b62f23 7693c5d5

+40 -31
+6 -4
doc/builders/special/mkshell.section.md
··· 1 1 # pkgs.mkShell {#sec-pkgs-mkShell} 2 2 3 - `pkgs.mkShell` is a special kind of derivation that is only useful when using it combined with `nix-shell`. It will in fact fail to instantiate when invoked with `nix-build`. 3 + `pkgs.mkShell` is a special kind of derivation that is only useful when using 4 + it combined with `nix-shell`. It will in fact fail to instantiate when invoked 5 + with `nix-build`. 4 6 5 7 ## Usage {#sec-pkgs-mkShell-usage} 6 8 7 9 ```nix 8 10 { pkgs ? import <nixpkgs> {} }: 9 11 pkgs.mkShell { 10 - # this will make all the build inputs from hello and gnutar 11 - # available to the shell environment 12 + # specify which packages to add to the shell environment 13 + packages = [ pkgs.gnumake ]; 14 + # add all the dependencies, of the given packages, to the shell environment 12 15 inputsFrom = with pkgs; [ hello gnutar ]; 13 - buildInputs = [ pkgs.gnumake ]; 14 16 } 15 17 ```
+2 -2
doc/languages-frameworks/dotnet.section.md
··· 10 10 11 11 mkShell { 12 12 name = "dotnet-env"; 13 - buildInputs = [ 13 + packages = [ 14 14 dotnet-sdk_3 15 15 ]; 16 16 } ··· 25 25 26 26 mkShell { 27 27 name = "dotnet-env"; 28 - buildInputs = [ 28 + packages = [ 29 29 (with dotnetCorePackages; combinePackages [ 30 30 sdk_3_1 31 31 sdk_3_0
+1 -1
doc/languages-frameworks/python.section.md
··· 245 245 ps.toolz 246 246 ]); 247 247 in mkShell { 248 - buildInputs = [ 248 + packages = [ 249 249 pythonEnv 250 250 251 251 black
+1 -1
doc/languages-frameworks/ruby.section.md
··· 106 106 name = "gems-for-some-project"; 107 107 gemdir = ./.; 108 108 }; 109 - in mkShell { buildInputs = [ gems gems.wrappedRuby ]; } 109 + in mkShell { packages = [ gems gems.wrappedRuby ]; } 110 110 ``` 111 111 112 112 With this file in your directory, you can run `nix-shell` to build and use the gems. The important parts here are `bundlerEnv` and `wrappedRuby`.
+5 -2
maintainers/scripts/update-luarocks-shell.nix
··· 2 2 }: 3 3 with nixpkgs; 4 4 mkShell { 5 - buildInputs = [ 6 - bash luarocks-nix nix-prefetch-scripts parallel 5 + packages = [ 6 + bash 7 + luarocks-nix 8 + nix-prefetch-scripts 9 + parallel 7 10 ]; 8 11 LUAROCKS_NIXPKGS_PATH = toString nixpkgs.path; 9 12 }
+1 -1
nixos/doc/manual/shell.nix
··· 4 4 pkgs.mkShell { 5 5 name = "nixos-manual"; 6 6 7 - buildInputs = with pkgs; [ xmlformat jing xmloscopy ruby ]; 7 + packages = with pkgs; [ xmlformat jing xmloscopy ruby ]; 8 8 }
+3 -3
pkgs/applications/editors/emacs-modes/emacs2nix.nix
··· 7 7 rev = "860da04ca91cbb69c9b881a54248d16bdaaf9923"; 8 8 sha256 = "1r3xmyk9rfgx7ln69dk8mgbnh3awcalm3r1c5ia2shlsrymvv1df"; 9 9 }; 10 - 11 - in pkgs.mkShell { 10 + in 11 + pkgs.mkShell { 12 12 13 - buildInputs = [ 13 + packages = [ 14 14 pkgs.bash 15 15 ]; 16 16
+1 -1
pkgs/applications/editors/emacs-modes/updater-emacs.nix
··· 29 29 in [ promise semaphore ]); 30 30 31 31 in pkgs.mkShell { 32 - buildInputs = [ 32 + packages = [ 33 33 pkgs.git 34 34 pkgs.nix 35 35 pkgs.bash
+2 -2
pkgs/applications/networking/cluster/nixops/shell.nix
··· 1 - { pkgs ? import <nixpkgs> {} }: 1 + { pkgs ? import <nixpkgs> { } }: 2 2 3 3 pkgs.mkShell { 4 - buildInputs = [ 4 + packages = [ 5 5 pkgs.poetry2nix.cli 6 6 pkgs.pkg-config 7 7 pkgs.libvirt
+1 -1
pkgs/build-support/agda/default.nix
··· 1 1 # Builder for Agda packages. 2 2 3 - { stdenv, lib, self, Agda, runCommandNoCC, makeWrapper, writeText, mkShell, ghcWithPackages, nixosTests }: 3 + { stdenv, lib, self, Agda, runCommandNoCC, makeWrapper, writeText, ghcWithPackages, nixosTests }: 4 4 5 5 with lib.strings; 6 6
+14 -10
pkgs/build-support/mkshell/default.nix
··· 3 3 # A special kind of derivation that is only meant to be consumed by the 4 4 # nix-shell. 5 5 { 6 - inputsFrom ? [], # a list of derivations whose inputs will be made available to the environment 7 - buildInputs ? [], 8 - nativeBuildInputs ? [], 9 - propagatedBuildInputs ? [], 10 - propagatedNativeBuildInputs ? [], 11 - ... 6 + # a list of packages to add to the shell environment 7 + packages ? [ ] 8 + , # propagate all the inputs from the given derivations 9 + inputsFrom ? [ ] 10 + , buildInputs ? [ ] 11 + , nativeBuildInputs ? [ ] 12 + , propagatedBuildInputs ? [ ] 13 + , propagatedNativeBuildInputs ? [ ] 14 + , ... 12 15 }@attrs: 13 16 let 14 17 mergeInputs = name: lib.concatLists (lib.catAttrs name 15 - ([attrs] ++ inputsFrom)); 18 + ([ attrs ] ++ inputsFrom)); 16 19 17 20 rest = builtins.removeAttrs attrs [ 21 + "packages" 18 22 "inputsFrom" 19 23 "buildInputs" 20 24 "nativeBuildInputs" ··· 26 30 27 31 stdenv.mkDerivation ({ 28 32 name = "nix-shell"; 29 - phases = ["nobuildPhase"]; 33 + phases = [ "nobuildPhase" ]; 30 34 31 35 buildInputs = mergeInputs "buildInputs"; 32 - nativeBuildInputs = mergeInputs "nativeBuildInputs"; 36 + nativeBuildInputs = packages ++ (mergeInputs "nativeBuildInputs"); 33 37 propagatedBuildInputs = mergeInputs "propagatedBuildInputs"; 34 38 propagatedNativeBuildInputs = mergeInputs "propagatedNativeBuildInputs"; 35 39 36 40 shellHook = lib.concatStringsSep "\n" (lib.catAttrs "shellHook" 37 - (lib.reverseList inputsFrom ++ [attrs])); 41 + (lib.reverseList inputsFrom ++ [ attrs ])); 38 42 39 43 nobuildPhase = '' 40 44 echo
+1 -1
pkgs/development/mobile/androidenv/examples/shell.nix
··· 115 115 in 116 116 pkgs.mkShell rec { 117 117 name = "androidenv-demo"; 118 - buildInputs = [ androidSdk platformTools jdk pkgs.android-studio ]; 118 + packages = [ androidSdk platformTools jdk pkgs.android-studio ]; 119 119 120 120 LANG = "C.UTF-8"; 121 121 LC_ALL = "C.UTF-8";
+2 -2
pkgs/tools/X11/opentabletdriver/shell.nix
··· 1 - { pkgs ? import ../../../../. {} }: 1 + { pkgs ? import ../../../../. { } }: 2 2 3 3 with pkgs; 4 4 5 5 mkShell { 6 - buildInputs = [ 6 + packages = [ 7 7 common-updater-scripts 8 8 curl 9 9 dotnetCorePackages.sdk_5_0