Skip to content

stdenv.mkDerivation: add support for env attrset#76732

Closed
jtojnar wants to merge 26 commits intostagingfrom
mkderiv-env
Closed

stdenv.mkDerivation: add support for env attrset#76732
jtojnar wants to merge 26 commits intostagingfrom
mkderiv-env

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

@ofborg ofborg bot added 6.topic: emacs Text editor 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: pantheon The Pantheon desktop environment 6.topic: printing Drivers, CUPS & Co. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. labels Dec 31, 2019
@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 Artturin closed this Dec 11, 2022
@jtojnar jtojnar deleted the mkderiv-env branch December 14, 2022 11:57
@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 Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: pantheon The Pantheon desktop environment 6.topic: printing Drivers, CUPS & Co. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: stdenv Standard environment 6.topic: xfce The Xfce Desktop Environment 8.has: documentation This PR adds or changes documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants