Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] devShellTools.buildShellEnv #330822

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

[WIP] devShellTools.buildShellEnv #330822

wants to merge 5 commits into from

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

  • 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.

@roberth roberth added the 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 +93
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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: haskell 6.topic: stdenv Standard environment significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants