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/check-meta: getEnv if the attribute is unset #72376

Merged
merged 1 commit into from Nov 3, 2019

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Oct 31, 2019

There were two issues:

  • builtins.getEnv was called deep into the nixpkgs tree making it hard
    to discover. This is solved by moving the call into
    pkgs/top-level/impure.nix
  • when the config was explicitly set by the user to false, it would
    still try and load the environment variable. This meant that it was
    not possible to guarantee the same outcome on two different systems.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

There were two issues:

* builtins.getEnv was called deep into the nixpkgs tree making it hard
  to discover. This is solved by moving the call into
  pkgs/top-level/impure.nix
* when the config was explicitly set by the user to false, it would
  still try and load the environment variable. This meant that it was
  not possible to guarantee the same outcome on two different systems.
@zimbatm zimbatm merged commit 71184f8 into NixOS:master Nov 3, 2019
@zimbatm zimbatm deleted the pure-check-meta branch November 3, 2019 17:40
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Nov 3, 2019
There were two issues:

* builtins.getEnv was called deep into the nixpkgs tree making it hard
  to discover. This is solved by moving the call into
  pkgs/top-level/impure.nix
* when the config was explicitly set by the user to false, it would
  still try and load the environment variable. This meant that it was
  not possible to guarantee the same outcome on two different systems.

(cherry picked from commit 71184f8)
inherit config overlays crossSystem crossOverlays;
inherit overlays crossSystem crossOverlays;

config = defaultConfig // config;
Copy link
Member

@veprbl veprbl Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config can be a function:

# Allow both:
# { /* the config */ } and
# { pkgs, ... } : { /* the config */ }
config1 =
if lib.isFunction config0
then config0 { inherit pkgs; }
else config0;

This broke nix-review.
https://github.com/Mic92/nix-review/blob/33c31f06b4e8e74e1b48e8df8cb8083041ec14ea/nix_review/buildenv.py#L40

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for debugging this and sorry about the breakage!

veprbl added a commit that referenced this pull request Nov 4, 2019
veprbl added a commit that referenced this pull request Nov 4, 2019
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Nov 4, 2019
zimbatm added a commit to zimbatm/nix-review that referenced this pull request Nov 4, 2019
It's not necessary to use a function since we don't use the pkgs
attribute. The config can just be an attribute set.

Related to NixOS/nixpkgs#72376 (comment)
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

3 participants