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

Make mpv mpris plugin install script not as $out #64976

Closed
wants to merge 1 commit into from

Conversation

doronbehar
Copy link
Contributor

Moved mpris.so to $out/etc/mpv/scripts/. Copying mpris.so to just $out doesn't really help users who wish to use this plugin, now, users can install this package to their environment and link: ~/.nix-profile/etc/mpv/scripts/mpris.so to ~/.config/mpv/scripts/.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Moved mpris.so to $out/etc/mpv/scripts/. Copying mpris.so to just $out
doesn't really help users who wish to use this plugin, now, users can
install this package to their environment and link:
~/.nix-profile/etc/mpv/scripts/mpris.so to ~/.config/mpv/scripts/.
@worldofpeace
Copy link
Contributor

So what I'm seeing is this is an mpv C plugin and it default loads them from .config/mpv/scripts.

But linking the way you've suggested here is impractical, apparently you can load a plugin if you just pass
--script $path_to_so on the command line. Can we use that feature somehow within nix?
I also wonder if you can pass multiple --script for multiple plugins or if it can be a directory.

@doronbehar
Copy link
Contributor Author

doronbehar commented Jul 18, 2019

linking the way you've suggested here is impractical

I'm not sure I agree. As I said in my first comment, only now, users can install this package to their environment and link: ~/.nix-profile/etc/mpv/scripts/mpris.so to ~/.config/mpv/scripts/. Without this change, the resulting mpris.so file resides somewhere on the store as the file itself (/nix/store/pn63s7zds9sj58qzc0wm2xq5gg7913j9-mpv-mpris-0.2.so) and it's impossible to predict it's path through updates (and garbage collections) if you want to link it to ~/.config/mpv/scripts/.

apparently you can load a plugin if you just pass --script $path_to_so on the command line. Can we use that feature somehow within nix?

However, after some investigation, it seems it is possible to use this plugin as is using mpv's wrapper a.k.a the derivation named mpv-with-scripts but I couldn't figure that out until now. In any case this is lack of documentation. I've managed to do it by adding the following to my ~/.config/nixpkgs/config.nix:

    mpv-with-scripts = pkgs.mpv-with-scripts.override {
      scripts = [pkgs.mpvScripts.mpris];
    };

Feel free to close this as merging it would break users who have used this method until now. As for the documentation, I think this is the kind of stuff that should enter the WiKi. I'll add a page for MPV when I'll find time.

EDIT:

I've documented what I learned in the WiKi: https://nixos.wiki/wiki/MPV

@worldofpeace
Copy link
Contributor

Hi @doronbehar I've had a hunch that something in that manner already existed.

As for documenting your findings at https://nixos.wiki/wiki/MPV thank you.
The official place for that to be documented would be the Package Notes section of the nixpkgs manual. But it's no less appropriate to have that in the wiki.

@worldofpeace
Copy link
Contributor

As for the documentation you wrote, note that packageOverrides aren't preferreed anymore so it would be more appropriate to use overlays.. If you have any questions on that feel free to ask or consult the manual.

@doronbehar doronbehar deleted the mpv-mpris branch July 22, 2019 06:44
@doronbehar
Copy link
Contributor Author

Thanks for referencing that. I've had some troubles replacing all of my package overrides with overlays. I've hit the same error as here but I couldn't figure out what's the solution from reading the comments. Also, following exactly what the official documentation suggested, I got other syntax / list vs set etc errors. Anyway, I can't really contribute a PR for the 'Package Notes' chapter in the manual.. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants