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

buildEnv: allow custom environment variables to be set #20822

Closed
wants to merge 1 commit into from

Conversation

adnelson
Copy link
Contributor

Motivation for this change

buildEnv allows for a postBuild step, but doesn't provide a mechanism for setting environment variables during that step besides inlining them into the bash string (which could have problems e.g. with special characters). This adds an environment parameter which allows environment variables to be set.

Things done

Not really anything to test here; none of the existing libraries use this. I've build envs of my own using this parameter, and it works.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@adnelson, thanks for your PR! By analyzing the history of the files in this pull request, we identified @vcunat, @aszlig and @edolstra to be potential reviewers.

@danbst
Copy link
Contributor

danbst commented Dec 1, 2016

The commit is authored by 'Test'. Is that intentional? :)

@adnelson
Copy link
Contributor Author

adnelson commented Dec 1, 2016

@danbst Whoops, not sure how that happened...

@adnelson
Copy link
Contributor Author

@edolstra This has been sitting here for a while, any chance it could get merged?

@matthewbauer
Copy link
Member

/cc @Mic92 bump?

@matthewbauer
Copy link
Member

matthewbauer commented May 24, 2017

One thing to note is that you can do away with passthru, meta, and buildInputs once you have this (for the arguments to buildEnv).

@mmahut
Copy link
Member

mmahut commented Aug 1, 2019

@adnelson @Mic92 Any update on this pull request?

@Mic92
Copy link
Member

Mic92 commented Aug 2, 2019

@GrahamcOfBorg eval

@mmahut
Copy link
Member

mmahut commented Oct 5, 2019

@Mic92 do you wish to keep this open?

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@L-as
Copy link
Member

L-as commented Apr 22, 2021

I don't think this is useful, since you can do what you want by just doing overrideAttrs on the buildEnv derivation then adding your postBuild and all necessary environment variables there.

I'm in favor of closing this.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 22, 2021
@roberth
Copy link
Member

roberth commented Aug 8, 2021

In addition to @L-as, for consistency we'd have to allow this everywhere, which is not feasible and not necessary.

@roberth roberth closed this Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants