Skip to content

Instantly share code, notes, and snippets.

@jtojnar
Last active February 12, 2021 18:28
Show Gist options
  • Save jtojnar/dc3b49c988bf1665980c296839ea4b81 to your computer and use it in GitHub Desktop.
Save jtojnar/dc3b49c988bf1665980c296839ea4b81 to your computer and use it in GitHub Desktop.
RFC: `env` attribute for setting `mkDerivation` environment

Work in Progress

Environment variables should go to env

Currently, the attributes passed to stdenv.mkDerivation serve two purposes:

  • controlling stdenv
  • setting environment variables

This RFC intends to untangle this situation by relegating the setting of environment variables to a dedicated env attribute set.

env attribute

Benefits

Stages

  • Add support for env to mkDerivation. The content would be passed back to derivation.
  • Move known environment attributes (nixpkgs-hammering has a list) to env (can be done semi-programmatically) and random attributes using recursive attrsets instead of lets into lets. Only stdenv options should remain.
  • Make stdenv take closed pattern as an argument. ¿TODO: How to deal with setup hooks that introduce extra parameters?

Current implementation

Alternatives

  • status quo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment