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
powershell: fix the build #41907
powershell: fix the build #41907
Conversation
I think you will need to add it to the library path for this to fix your problem. |
@matthewbauer I can do that, however currently .so's referring to these libraries resolve well:
Do you think I need to cover that in |
Amended the patch to include all libraries in the wrapper. |
pkgs/shells/powershell/default.nix
Outdated
@@ -22,7 +23,7 @@ stdenv.mkDerivation rec { | |||
}; | |||
|
|||
buildInputs = [ autoPatchelfHook makeWrapper ]; | |||
propagatedBuildInputs = [ libunwind libuuid icu curl cacert less openssl ]; | |||
propagatedBuildInputs = [ cacert less ] ++ libraries; |
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.
Why are all those packages in propagatedBuildInputs?
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.
Perhaps I don't fully understand that part yet. The intention here was to submit that those are runtime dependencies, and not explosively build-time ones. If there's another, correct way to do this, please let me know.
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.
Nix figures out runtime dependencies by inspecting what files are referenced by a derivation.
Sometimes it cannot do this if for example an program do PATH search to run a different program.
In this case we use for example makeWrapper to extend the programs PATH.
propagatedBuildInputs
will only be pulled if it this package is used as an build input for a different package.
This is also the case for nix-shell by accident, which is why people sometimes think propagatedBuildInputs
affect the runtime dependencies. Python is an exception to this rule since it uses propagatedBuildInputs
in its own wrapper to extend the PYTHONPATH to contain all required python libraries used in an python script.
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.
less is already covered by the PAGER variable. Where is cacert used in powershell?
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.
As for PAGER
, this is because there's a bug handling PAGER with arguments in the current release and there's a comment in this in the original nix file for PowerShell:
# TODO: remove PAGER after upgrading to v6.1.0-preview.1 or later as it has been addressed in
# https://github.com/PowerShell/PowerShell/pull/6144
Without this setting, current version will fail commands like Help
:
PS /home/yrashk/Projects/nix/nixpkgs> help
Get-Command : The term 'less -R' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Once 6.1 is released, this can be removed.
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.
I've simplified build inputs to make this a much cleaner derivation as per your guidance.
@@ -31,7 +32,7 @@ stdenv.mkDerivation rec { | |||
mkdir -p $out/share/powershell | |||
cp -r * $out/share/powershell | |||
rm $out/share/powershell/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY | |||
makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath [ libunwind libuuid icu openssl curl ]}" \ | |||
makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath libraries}" \ |
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.
Are the packages opened with dlopen? Adding libraries to library paths is probably only required on macOS, where no patchelf is used.
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.
Yes, they are not explicitly linked to this libraries, that's why this approach was used in the first place.
This patch doesn't change that, just adds more libraries that /for some reason/ weren't an issue before.
For some reason, building powershell derivation started failing with these errors: ``` liblttng-ust.so.0 -> not found! ... libpam.so.0 -> not found! ``` This patch adds these dependencies
For some reason, building powershell derivation started failing with
these errors:
This patch adds these dependencies
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)