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

stdenv.mkDerivation: add support for env attrset #76732

Closed
wants to merge 26 commits into from
Closed

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Dec 31, 2019

Motivation for this change

For __structuredAttrs, we want to distinguish regular structured variables from string-coercible variables that will be exported to the environment. The environment variables will be passed to mkDerivation as attributes of the env attribute set.

To lower the review workload of the __structuredAttrs PR, we have decided to make the env mechanism available as a vanguard. Until the support for __structuredAttrs is implemented, the content of the env attrset will be merged into the attrset passed to mkDerivation.

The content of the attributes in env is checked for validity and conflicts with the rest of mkDerivation attributes. The current mechanism should produce the same derivations as the original, thus require no rebuilds.

This change is backwards compatible for now, as Nix does not allow attrsets to be passed to derivation without __structuredAttrs enabled, and the current mechanism handles the non-attrsets as before. We reserve the right to require env to be attrset in the future.


Only the first commit is important, the rest is cherry-picked from #72074.

cc @globin @Ericson2314 @Ma27

@jtojnar jtojnar marked this pull request as draft June 1, 2020 05:23
@ryantm ryantm added the 2.status: merge conflict This PR has merge conflicts with the target branch label Oct 3, 2020
@teto
Copy link
Member

teto commented Jan 29, 2021

anything that helps with __structuredAttrs is ok in my book.

@stale
Copy link

stale bot commented Jul 29, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 29, 2021
@Artturin
Copy link
Member

env attrset added in #175649

@Artturin
Copy link
Member

Was having lists in env automatically have toString run on them ever considered?

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 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: emacs Text editor 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: golang 6.topic: haskell 6.topic: lua 6.topic: pantheon The Pantheon desktop environment 6.topic: printing 6.topic: python 6.topic: qt/kde 6.topic: ruby 6.topic: rust 6.topic: stdenv Standard environment 6.topic: xfce The Xfce Desktop Environment 8.has: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants