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: fix propagatedUserEnvPkgs when __structuredAttrs is true again #392928

Conversation

jian-lin
Copy link
Contributor

This is a follow-up of #388908.

Previously, $out/nix-support/propagated-user-env-packages was not created when __structuredAttrs was enabled, the first element of propagatedUserEnvPkgs was null and the length of propagatedUserEnvPkgs was at least 2.

Fixes #388829

With this patch applied, condition check result for each propagatedUserEnvPkgs is shown below.

propagatedUserEnvPkgs __structuredAttrs enabled __structuredAttrs disabled
null false false
[ ] false false
[ null ] false false
[ null "foo" ] true ( previously was false) true

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

This is a follow-up of NixOS#388908.

Previously, $out/nix-support/propagated-user-env-packages was not
created when __structuredAttrs is true, the first element of
propagatedUserEnvPkgs is null and the length of propagatedUserEnvPkgs
is at least 2.

Fixes NixOS#388829
@ShamrockLee
Copy link
Contributor

The setup.sh change looks good.

Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

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

Ah, I even thought about this part in the fir PR - but then assumed that "nobody is going to pass an empty string as the first pkg anyway, so it should be fine". Didn't think about null.

Copy link
Member

@RossComputerGuy RossComputerGuy left a comment

Choose a reason for hiding this comment

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

LGTM

@ShamrockLee ShamrockLee added the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Mar 25, 2025
@ShamrockLee
Copy link
Contributor

ShamrockLee commented Mar 25, 2025

To err on the safe side before merging, has anyone built and confirmed that it works?

I originally planned to test it tonight, but my tablet is temporarily unavailable.

@RossComputerGuy
Copy link
Member

What attribute do you want tested? I'll spin up a build on my Ampere system at home.

@ShamrockLee
Copy link
Contributor

ShamrockLee commented Mar 25, 2025

What attribute do you want tested?

I would like to see if

pkgs.hello.overrideAttrs { __structuredAttrs = true; propagatedUserEnvPkgs = [ null pkgs.bash ]; }

built output produces the correct $out/nix-support/propagated-user-env-packages file.

I would be curious about the result for [ null null pkgs.bash ] and [ null null ] as well.

I'll spin up a build on my Ampere system at home.

Thanks a lot!

@RossComputerGuy
Copy link
Member

I would like to see if

pkgs.hello.overrideAttrs { __structuredAttrs = true; propagatedUserEnvPkgs = [ null pkgs.bash ]; }

built output produces the correct $out/nix-support/propagated-user-env-packages file.

I would be curious about the result for [ null null pkgs.bash ] and [ null null ] as well.

Ok it built and only has bash interactive in it.

 /nix/store/63j885krhx6yc0dv8z5z5csg97ihz7hy-bash-interactive-5.2p37

Copy link
Contributor

@ShamrockLee ShamrockLee left a comment

Choose a reason for hiding this comment

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

I know little about Emacs and its plugins.

Nevertheless, since stdenv's setup.sh works as expected, plut two other approavals, it should be safe to merge.

@ShamrockLee ShamrockLee added 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people and removed 12.approvals: 2 This PR was reviewed and approved by two reputable people labels Mar 25, 2025
@ShamrockLee ShamrockLee merged commit bc12294 into NixOS:staging Mar 25, 2025
30 of 31 checks passed
@jian-lin jian-lin deleted the pr/propagatedUserEnvPkgs-__structuredAttrs-fix-2 branch March 25, 2025 21:26
jian-lin added a commit to linj-fork/nixpkgs that referenced this pull request Mar 26, 2025
The issue NixOS#392928 fixes seems to affect many elisp packages.  For
example, about 900 MELPA packages are affected.  This commit is a
temporary fix and should be reverted after NixOS#392928 reaches master.

Close: NixOS#388829
@jian-lin jian-lin changed the title stdenv: fix propagatedUserEnvPkgs when __structuredAttrs is true stdenv: fix propagatedUserEnvPkgs when __structuredAttrs is true again Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants