Skip to content

rl2009.xml: Mention wrapMpv's new interface#89208

Merged
Profpatsch merged 2 commits intoNixOS:masterfrom
doronbehar:wrapMpv
Jun 11, 2020
Merged

rl2009.xml: Mention wrapMpv's new interface#89208
Profpatsch merged 2 commits intoNixOS:masterfrom
doronbehar:wrapMpv

Conversation

@doronbehar
Copy link
Contributor

@doronbehar doronbehar commented May 30, 2020

Motivation for this change

#88620 (comment) cc @Profpatsch .

Things done

I haven't tested the build of the docs and how they look like...

  • 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.

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels May 30, 2020
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 pushed a commit to nix-community/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
@Profpatsch
Copy link
Member

Can we change the abort in mpv-with-scripts to a deprecation warning plus a rewrite to the new module?

@doronbehar
Copy link
Contributor Author

I won't mind, but I can't find an example I can follow. I mean, I could do this:

diff --git i/pkgs/top-level/aliases.nix w/pkgs/top-level/aliases.nix
index ff405131074..f084ab534ba 100644
--- i/pkgs/top-level/aliases.nix
+++ w/pkgs/top-level/aliases.nix
@@ -306,7 +306,9 @@ mapAliases ({
   msf = metasploit; # added 2018-04-25
   libmsgpack = msgpack; # added 2018-08-17
   mssys = ms-sys; # added 2015-12-13
-  mpv-with-scripts = throw "Use wrapMpv for editing the environment of mpv"; # added 2012-05-22
+  mpv-with-scripts = lib.warn "Use wrapMpv for editing the environment of mpv" (
+    super.wrapMpv super.mpv-unwrapped { }
+  ); # added 2020-05-22
   multipath_tools = multipath-tools;  # added 2016-01-21
   mupen64plus1_5 = mupen64plus; # added 2016-02-12
   mysqlWorkbench = mysql-workbench; # added 2017-01-19

But according to my tests, overlays don't apply to it. If we can't find a way to make overlays apply as well, I think this behavior is worse then a harsh throw error. It might take longer for a user to debug "why mpv behaves as if it didn't load my script" vs to notice and deal with a throw error. Because, the user will run mpv most likely only a while after their update, and a warning might get away from their attention.

Instead of manually quoting the strings, use the library function to do
it more reliably.
@Profpatsch
Copy link
Member

diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index 03b03ff2a84..b647face390 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -309,7 +309,9 @@ mapAliases ({
   msf = metasploit; # added 2018-04-25
   libmsgpack = msgpack; # added 2018-08-17
   mssys = ms-sys; # added 2015-12-13
-  mpv-with-scripts = throw "Use wrapMpv for editing the environment of mpv"; # added 2012-05-22
+  mpv-with-scripts = lib.warn "Use wrapMpv for editing the environment of mpv" (
+    self.wrapMpv self.mpv-unwrapped { }
+  ); # added 2020-05-22
   multipath_tools = multipath-tools;  # added 2016-01-21
   mupen64plus1_5 = mupen64plus; # added 2016-02-12
   mysqlWorkbench = mysql-workbench; # added 2017-01-19

works just fine for me

@doronbehar
Copy link
Contributor Author

@Profpatsch if you'll apply that diff and run:

nix-build -A mpv-with-scripts

You should be able to get a working mpv wrapper. But if you will add this overlay to your nixpkgs' config:

self: super:

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

And run:

nix-build -A test-mpv-with-scripts

You should be able to see that:

cat result/bin/mpv | grep mpris.so

is empty - meaning the .override wasn't applied.

@Profpatsch
Copy link
Member

Profpatsch commented Jun 11, 2020 via email

To prevent a breaking change while providing fully backwards compatible
interface to mpv-with-scripts, this replaces the harsh error using
`mpv-with-scripts` had.
@doronbehar
Copy link
Contributor Author

Note that I switched from super.wrapMpv to self.wrapMpv in my example
above. It applied the override script just fine here.

Didn't notice. nice 👍.

I've updated the PR to include your diff and my release notes changes rebased on latest master.

@ofborg ofborg bot removed 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation labels Jun 11, 2020
@Profpatsch
Copy link
Member

LGTM

@Profpatsch Profpatsch merged commit 7be315a into NixOS:master Jun 11, 2020
@adisbladis
Copy link
Member

This broke ofborg eval, fixed in 9de29f6.

@dotlambda
Copy link
Member

This broke umpv: #90549

colemickens pushed a commit to colemickens/home-manager that referenced this pull request Jun 24, 2020
colemickens pushed a commit to colemickens/home-manager that referenced this pull request Jun 27, 2020
colemickens pushed a commit to colemickens/home-manager that referenced this pull request Jul 20, 2020
@doronbehar doronbehar deleted the wrapMpv branch March 2, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants