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

mpv: Move all wrappings to a single wrapper Nix function #88620

Merged
merged 1 commit into from May 25, 2020

Conversation

@doronbehar
Copy link
Contributor

doronbehar commented May 22, 2020

Motivation for this change

In #88136 I concluded that mpv's wrapping was done purely - both the "unwrapped" build had done some wrappings to the two executables in $out/bin/, while we already had an external wrapper derivation called mpv-with-scripts. This was bad because:

  1. Users of mpv-with-scripts had their executable wrapped twice.
  2. disabling youtubeSupport caused mpv to be wrapped twice while it was a mere change of including youtube-dl in the wrapper's $PATH or not.
  3. If you'd want youtubeSupport enabled, but say you had an override for an updated youtube-dl, it was impossible to make mpv use your youtube-dl without recompiling it.
Things done

This PR is a rewrite of what was called mpv-with-scripts - it's now called wrapMpv (inspired by Neovim's wrapNeovim Nix function) and it's possible with it to satisfy both "deterministics" which want everything to be configured exactly as they want via Nix while it enables everyone to tweak what's possible via an external wrapper which doesn't trigger a rebuild of mpv.

I tested wrapMpv with:

  • mpv-unwrapped was compiled with and without vapoursynthSupport enabled - checked that the wrapper got the same environment but:
    • I haven't tested functionality of this feature.
  • A certain script - checked that the necessary flags are added to the wrapper and also tested that the script works.
  • Tested that youtubeSupport works (of course it works as the exectuable has the same environment).

Besides that, as always:

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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.

cc @pstch @AndersonTorres @jtojnar

@doronbehar doronbehar mentioned this pull request May 22, 2020
6 of 10 tasks complete
pkgs/top-level/aliases.nix Outdated Show resolved Hide resolved
@doronbehar
Copy link
Contributor Author

doronbehar commented May 22, 2020

@GrahamcOfBorg build mpv-unwrapped

@GrahamcOfBorg build mpv

@doronbehar
Copy link
Contributor Author

doronbehar commented May 22, 2020

Is it me or do these build commands don't work? :/

@ajs124
Copy link
Member

ajs124 commented May 22, 2020

They only work if you're a whitelisted user.

@doronbehar
Copy link
Contributor Author

doronbehar commented May 22, 2020

@doronbehar doronbehar force-pushed the doronbehar:wrapMpv branch from 16c460b to 55f2479 May 23, 2020
@ofborg ofborg bot requested a review from AndersonTorres May 23, 2020
Inspired by `wrapNeovim`, write a wrapMpv Nix function that creates a
derivation that has all of the environment that was added if needed at
the unwrapped version.

Add derivations to all-packages.nix in an almost compatible way and make
`mpv-with-scripts` throw a message implying to switch to `wrapMpv` which
has an incompatible signature.

Add to vapoursynth a new passthru attribute `python3` that is used in
passed down to the wrapper to ensure ABI compatibility with
`PYTHONPATH`.
@doronbehar doronbehar force-pushed the doronbehar:wrapMpv branch from 55f2479 to f93918b May 23, 2020
Copy link
Member

AndersonTorres left a comment

Just looking from above, feels good to me, and way more organized.
Pushing out the wrap logic is a great improvement.

@teto
teto approved these changes May 25, 2020
Copy link
Contributor

teto left a comment

It's more inline with current nixpkgs' approach.

@AndersonTorres AndersonTorres merged commit c51d8d6 into NixOS:master May 25, 2020
17 checks passed
17 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="f93918b"; rev="f93918bdc387d353285f458c06c6a111ae90b7b2"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
mpv, mpv.passthru.tests on aarch64-linux Success
Details
mpv, mpv.passthru.tests on x86_64-darwin Success
Details
mpv, mpv.passthru.tests on x86_64-linux Success
Details
@Profpatsch
Copy link
Member

Profpatsch commented May 28, 2020

It would be great if symbols like mpv-with-wrappers would get a deprecation period instead of breaking downstream immediately.

Since this is a breaking change, this requires an entry in the release notes cc @doronbehar @AndersonTorres

@doronbehar doronbehar mentioned this pull request May 30, 2020
5 of 10 tasks complete
@doronbehar
Copy link
Contributor Author

doronbehar commented May 30, 2020

You are correct. It was on my mind, I wanted to get some feedback before adding to the PR the changes to rl-2009 but I forgot about it after a while. See: #89208

berbiche added a commit to berbiche/home-manager that referenced this pull request May 31, 2020
berbiche added a commit to berbiche/home-manager that referenced this pull request May 31, 2020
rycee added a commit to rycee/home-manager that referenced this pull request May 31, 2020
The latter has been removed from Nixpkgs.

See:

- <NixOS/nixpkgs#88620>
- <NixOS/nixpkgs#89208>

PR #1295
colemickens added a commit to colemickens/home-manager that referenced this pull request Jun 24, 2020
The latter has been removed from Nixpkgs.

See:

- <NixOS/nixpkgs#88620>
- <NixOS/nixpkgs#89208>

PR rycee#1295
colemickens added a commit to colemickens/home-manager that referenced this pull request Jun 27, 2020
The latter has been removed from Nixpkgs.

See:

- <NixOS/nixpkgs#88620>
- <NixOS/nixpkgs#89208>

PR rycee#1295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.