gitMinimal: Fix wrong shell for cross compiled package#141959
gitMinimal: Fix wrong shell for cross compiled package#141959Artturin merged 1 commit intoNixOS:stagingfrom
Conversation
There was a problem hiding this comment.
Don't we have a way to get the target shell at compile time? (runtimeShell?) Will git use that shell at build time as well as runtime?
There was a problem hiding this comment.
Yes, Git will use SHELL_PATH during build as well on the target.
There was a problem hiding this comment.
The target shell can be access via targetPacages.bash.
pkgs/applications/version-management/git-and-tools/git/default.nix
Outdated
Show resolved
Hide resolved
|
setting the SHELL_PATH is a variable that has been there since at least 2007 and is not needed anymore.
|
|
Removing SHELL_PATH is a regression for the native built package, since the fixup phase patches not all /bin/sh occurrences. |
|
alright, should be fine now |
|
Your version do not build, since SHELL_PATH is executed during build: The Git package do not allow to specify build and target shell differently. On non NixOS systems, this doesn't matter, since the absolute paths to a shell is the same between build and target system. |
This comment has been minimized.
This comment has been minimized.
|
I think you configured your system to emulate aarch64 via NixOS option |
|
Thanks, that was indeed the case :/ |
I agree with you maybe open an issue for that? |
|
I created #142778 to face the impurity problem. So we can come back to gitMinimal, this PR is still valid and feedback is welcome. I hope we can get the cross compiled gitMinimal fixed, since it is a mandatory dependency for Nix flakes. |
r-burns
left a comment
There was a problem hiding this comment.
Thank you for this, I was not aware of this issue but have now verified locally that cross-compiled git uses incorrect shebangs because of SHELL_PATH.
To mitigate future regressions, how about adding something like this:
disallowedReferences = optionals (buildPlatform != hostPlatform) [
stdenv.shell
]
Then the package will fail the build, instead of silently using bad shebangs
There was a problem hiding this comment.
This is already an improvement, but I'd still like the cross-compiled git to refer exactly to its buildInputs in the store when possible. Can we add a postInstall patchShebangs --host step when cross-compiling?
There was a problem hiding this comment.
There are references which aren't shebangs
There was a problem hiding this comment.
Sure, would be good to patch those too if possible. If not, /bin/sh is at least better than a shell that can't be executed at all.
There was a problem hiding this comment.
The path /bin/sh is embedded in binaries and I did not find an easy way to replace the path without breaking the executable.
|
Thanks, great idea, but when I set That's weird, since nix-store doesn't show the dependency. |
7d44fb7 to
7bfd3a8
Compare
|
had to force push to fix the checks |
|
I think this broke the NixOS option |
|
in what way did it break? |
|
this shouldn't have affected that at all? |
|
I was getting But it looks like |
The current package depends on the build hosts shell and therefor a lot of scripts can not be used on the target:
This patch fixed the dependency to the build hosts shell:
Motivation for this change
Want to use cross compiled gitMinimal package.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)