Skip to content

Comments

[WIP] devShellTools.buildShellEnv#330822

Draft
roberth wants to merge 6 commits intomasterfrom
devShellTools-shell
Draft

[WIP] devShellTools.buildShellEnv#330822
roberth wants to merge 6 commits intomasterfrom
devShellTools-shell

Conversation

@roberth
Copy link
Member

@roberth roberth commented Jul 29, 2024

Description of changes

Note: this is currently draft, because it does not have sufficient tests and documentation for a number of features.
Help wanted :) This is a NixOS/nixpkgs branch, where all maintainers can push, but maybe sync with me first.

Implement build shells and development shells in Nixpkgs for greater flexibility and evolution of the Nix shell concept.

Terminology cheat sheet

  • Nix shell: the general concept of launch a shell with Nix-provided stuff in its environment
  • nix shell: nix env shell
  • build shell: a stdenv-based environment that's automatically derived from a derivation (see make-derivation.nix), useful for troubleshooting a build
  • dev shell: an environment for development. This may be constructed with stdenv-based infra with mkShell, or with other projects like cachix/devenv, numtide/devshell, etc, provided they'll implement the devShell interface

TODO

  • enable impure PATH by default?
  • more tests
  • docs
    • specifically the devShell attribute and the interface of its output
    • example of customizing the devShell
    • (a small part of it will also be a Nix interface: the proposed, extra nix develop and nix print-dev-env behaviors. This is very small and ok to duplicate.)
  • structuredAttrs support (maybe, or omit its devShell attr for now)
  • fine tune the terminology
  • make mkShell return an impure shell by default, because it's for dev shells?
  • validate in practice with an implementation of Allow to get rid of nix develop "shell" logic nix#7501

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: stdenv Standard environment labels Jul 29, 2024
@roberth roberth added the 1.severity: significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. label Jul 29, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 10, 2024
Comment on lines +89 to +110
export NIXPKGS_SHELL_TMP="$(mktemp -d --tmpdir nixpkgs-shell-${name}.XXXXXX)"
export TMPDIR="$NIXPKGS_SHELL_TMP"
export TEMPDIR="$NIXPKGS_SHELL_TMP"
export TMP="$NIXPKGS_SHELL_TMP"
export TEMP="$NIXPKGS_SHELL_TMP"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No NIX_BUILD_TOP. Should we have it? It's not a build...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a shell for a build, at least in principle, so yes

@roberth roberth mentioned this pull request Dec 9, 2024
13 tasks
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 25, 2025
@roberth roberth force-pushed the devShellTools-shell branch 2 times, most recently from b630090 to c8c1473 Compare July 22, 2025 06:14
@nixpkgs-ci nixpkgs-ci bot removed 2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md labels Jul 22, 2025
roberth added 2 commits August 2, 2025 18:06
Some tests use __bootPackages, and we'd like to support that even
if we override stdenv, e.g. to add devShell to mkDerivation in a
later commit.
@roberth roberth force-pushed the devShellTools-shell branch from c8c1473 to 20ce2bc Compare August 2, 2025 16:06
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Aug 2, 2025
@roberth roberth force-pushed the devShellTools-shell branch from 20ce2bc to 3bc9864 Compare August 2, 2025 16:18
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Oct 17, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.severity: significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. 2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: stdenv Standard environment 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants