-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
cmake: remove fixCmakeFiles #232522
base: staging
Are you sure you want to change the base?
cmake: remove fixCmakeFiles #232522
Conversation
Nice, this should fix #24215. |
I'm not a darwin person, but AFAIK sandbox is still not enabled in there by default and |
On |
Actually, on |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/making-a-development-flake-for-bespoke-synth/29988/19 |
hmmm, not sure if we can just chance that and hope for the best?
Can someone more firm in darwin comment on that? |
MacPorts and Homebrew (aarch64-darwin) both put stuff in |
I think this is acceptable as this was creating lots of subtle bugs and sometimes evening installing files into void.
but that's also true for any other PATH and those lines of code caused probably more breakages than they fixed and didn't work like expected in the first place anyway. Also aren't the builds run under a different user even outside the sandbox? If that can't write to there, we should be safe, otherwise this seems like a big glaring issue that affects darwin in general. |
f92c10f
to
a53d2e0
Compare
I really just want to kill it. Can we please kill it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@K900 It is not acceptable to make things worse on Darwin just because you don't care.
Given that the sandbox is off by default on Darwin (which seems to be because it doesn't work well enough), this PR would introduce a huge amount of impurities on Darwin. This would be the case not only for users who have Homebrew and/or MacPorts installed alongside Nix, but for any Darwin user, since the system puts files in To me, this seems like a change that would be a huge detriment to users of Nix on Darwin while providing comparatively little benefit to other Nix users |
I think I know why the hook is there now. These are the results of applying it to cmake itself: https://gist.github.com/K900/1da3c1e5e1a46ae1dd5c413f9ec35b1d |
@K900 Thank you. First we need to fix that particular problem you've mentioned, and then let's try to figure out the impact of a PR like this before we merge such a thing. |
If this seems to be only useful on darwin, why not make it a darwin only thing and on Linux we just rely on the sandbox? |
That seems reasonable to me. And if the Darwin sandbox does reach a point where it is effective and can be enabled by default, this PR could be revisited on Darwin. |
How will this affect building inside nix-shell on non-NixOS? |
It will not. |
Aaaah so that's what was going on.
Ran into one of these myself during what would otherwise be a maintenance bump of a package because Since this PR seems a ways from being merged, maybe a quick win would be making the sed expression more specific?
I'm not sure exactly which characters are allowed in filepaths, but at the very least |
a53d2e0
to
b749dd3
Compare
Rewriting /usr and /opt to /var/empty is no longer necessary since the sandbox was introduced. It also introduced unexpected side effects and changes paths like $out/etc/opt/ to $out/etc/var/empty/
b749dd3
to
44d5f20
Compare
FWIW I think the way to fix this is to proceed with the approach in #290170. I even got a Hydra jobset for it, but never got around to investigating the failures: https://hydra.nixos.org/jobset/nixpkgs/pr-290170-cmake-hook-shenanigans |
The build failures there are random failures/time outs. |
Not all of them, though a lot of them are in fact garbage. |
@K900 any insights from the above Hydra run? |
Everything explodes really badly, notably cmake itself. Someone needs to go through cmake and fix it, and then we can continue. |
@SuperSandro2000, should this then be marked draft or closed? Seems this proposed way forward has some serious thorns. |
We still want to remove those few lines of shell since they cause really bad side effects but we probably need to fix some of the build failures. |
It is, but the Darwin module bundled with CMake searches those locations by default. It would be nice if it could be made not to do that (even if it doesn’t address every possible problem).
The concern wasn’t about writing to those locations. It’s that packages installed with other package managers could be picked up instead of those provided by nixpkgs (e.g., enabling unwanted/unexpected features or causing other problems). This actually is causing problems for the Darwin refactor. I have a workaround unless this lands first, but I wouldn’t mind a patch or fixup to address the default search paths including other package managers on Darwin. |
After working on #346043 and testing #349555, I would support undoing at least the On Darwin, |
I think that we could reasonably specialize it to |
After some discussion on Matrix, we came up with the idea that, since |
Rewriting /usr and /opt to /var/empty is no longer necessary since the sandbox was introduced. It also introduced unexpected side effects and changes paths like $out/etc/opt/ to $out/etc/var/empty/
Closes #24215
Description of changes
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)