-
-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
pywalfox-native: fixup manifest installation #282408
pywalfox-native: fixup manifest installation #282408
Conversation
@ofborg eval |
Output of 2 packages built: |
with this PR i can get that said, the browser extension for me still says disconnected, with the fetch button yielding a not connected error. as per the extension's troubleshooting section, my my browser extension uses version 2.0.11. |
@KiaraGrouwstra Hi, thanks for the info. I've tested this on all setups that are available to me (NixOS only VM, NixOS with HM install, HM only). The pywalfox extension works by setting up a native-messaging-host specification at Could you please provide me with more information about your setup?
Also the {
"name": "pywalfox",
"description": "Automatically theme your browser using the colors generated by Pywal",
"path": "/nix/store/9x3lcmq4zjqaxmsnb3vaj7wnjmps05bw-pywalfox-native-2.7.4/lib/python3.11/site-packages/pywalfox/bin/main.sh",
"type": "stdio",
"allowed_extensions": [ "[email protected]" ]
} are you able to manually execute the Thanks in advance <3. |
# Overwrite the original wrapper script with a new one that has the | ||
# appropriate executable paths. | ||
cat > $out/lib/${python3.libPrefix}/site-packages/pywalfox/bin/main.sh <<'EOF' | ||
#!${stdenv.shell} |
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.
#!${stdenv.shell} | |
#!${runtimeShell} |
# appropriate executable paths. | ||
cat > $out/lib/${python3.libPrefix}/site-packages/pywalfox/bin/main.sh <<'EOF' | ||
#!${stdenv.shell} | ||
${placeholder "out"}/bin/pywalfox start |
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.
${placeholder "out"}/bin/pywalfox start | |
$out/bin/pywalfox start |
It may be better if you override this script with makeShellWrapper
directly.
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.
@Aleksanaa Since the original main.sh
directly calls python pywalfox
(https://github.com/Frewacom/pywalfox-native/blob/master/pywalfox/bin/main.sh#L10) I'd need to write something along these lines
postInstall = ''
export PYWALFOX=$out/lib/${python3.libPrefix}/site-packages/pywalfox/
chmod +x $PYWALFOX/bin/main.sh
makeShellWrapper $PYWALFOX/bin/main.sh $out/bin/patched-main.sh \
--prefix PATH : ${lib.makeBinPath [ (python3.withPackages [ self??? ]) ]}
substituteInPlace $PYWALFOX/config.py \
--replace "BIN_PATH_UNIX = os.path.join(APP_PATH, 'bin/main.sh')" \
"BIN_PATH_UNIX = \"$out/bin/patched-main.sh\""
# ....
'';
which felt a bit overcomplicated and I am still not entirely sure how would I "correctly" handle the self
reference. Hence why I opted to just replace the original script with a new one.
Also the point of the original main.sh
is to just run pywalfox start
but ensure it works on different setups (under root, macos, etc..), however, in nix we have all the paths under our control, which is why I feel like the original main.sh
in not really needed and we can replace it with our one instead of wrapping it, which just brings unnecessary patching on our side.
pywalfox-native: fix install
bbb3deb
to
f4724cf
Compare
@Aleksanaa I looked into the |
Description of changes
Resolves #281377. At first I tried setting up the manifest file directly from the derivation by outputting it at
$out/usr/lib/mozilla/native-messaging-hosts/pywalfox.json
, which didn't work and ultimately even if it did it wouldn't be able to cover all the cases/usr/lib/mozilla/native-messaging-hosts/pywalfox.json
).mozilla/native-messaging-hosts/pywalfox.json
)The conclusion is that NixOS/HM modules can also be prepared to automatically set up the manifest file (which is how I was personally using it before), however, an imperative default, that is
pywalfox install
, should still remain to cover the other use cases if needed. Thus the following PR patches theinstall.py
script to work with the structure of the nix store.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.