NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.72k stars 13.16k forks source link

VLC needs libaacs for encrypted Blu Ray #63641

Open WhittlesJr opened 5 years ago

WhittlesJr commented 5 years ago

Issue description

I think all it needs is libaacs in its buildInputs. I tried doing this myself, but ran into multiple build errors, which are seemingly not caused by the change... even just trying to rebuild it with no substantial changes (at 83ba5afcc9682b52b39a9a958f730b966cc369c5) gives me build errors. How is this building and why can't I build it??

configuring
fixing libtool script ./autotools/ltmain.sh
no configure script, doing nothing
sed: can't read config.h: No such file or directory
builder for '/nix/store/db0fcyq3f005549ksxwx7jrx4hz5jcbh-vlc-3.0.7.1.drv' failed with exit code 2

Steps to reproduce

Try to rebuild VLC on your own.

Technical details

WhittlesJr commented 5 years ago

Er, never mind about the build errors. I updated to 93580a122e8 and I can build.

But just adding libaacs to the buildInputs does not seem to fix the problem... VLC still complains about not having an AACs parsing library. (I do have the keys as well in ~/.config/aacs.)

WhittlesJr commented 5 years ago

I found that the following is actually all that is needed:

{
  nixpkgs.overlays = [
    (
      self: super: {
        libbluray = super.libbluray.override {
          withAACS = true;
          withBDplus = true;
        };
      }
    )
  ];
}

Found that in @jluttine's config (via some IRC log stalking.) I'm curious how withAACS and withBDPlus are supposed to work here... my naive assumption was that just having libaacs and libbdplus in your packages would do it, but that wasn't it. Is an override the "correct" way? With a satisfactory answer, this issue can be closed.

jtojnar commented 5 years ago

Yeah, adding dependencies to buildInputs does it most of the time (though, here we also need to add some extra link flags).

The withFoo parameters are an idiom to allow easily disabling the inclusion of some dependencies because they are too big and would blow up the closure size, are unfree and would make the package unfree, or are legally questionable in some jurisdictions.

Since we sometimes do not need those libraries, we default the parameters to null to allow not passing them when creating the package manually. The assert is there in case someone wants to enable a dependency and forgets to pass it in. Though since packages are usually created using callPackage, which will pass the dependencies anyway unless manually replaced by null, the assertion will usually succeed.

WhittlesJr commented 5 years ago

@jtojnar, Thanks, I figured it was something like that. Is the "right" way to enable the withFoo parameters something like the following, or is there an even simpler way?

let
  libbluray = callPackage pkgs.libbluray { 
    withAACS = true; 
    withBDPlus = true;  
    libaacs = pkgs.libaacs; 
    libbdplus = pkgs.libbdplus;
  };
  vlc = callPackage pkgs.vlc { libbluray = libbluray; };
in
{
  environment.systemPackages = [ vlc ];
}

That's probably wrong in a lot of ways, I can't test right now. But the overlays route is definitely less verbose than my guess above so I hope there's a better way.

jtojnar commented 5 years ago

callPackage is used with path not package. And there is no need to call it again.

Your overlay solution is pretty spot on. You can do it in configuration.nix too.

let
  libbluray = pkgs.libbluray.override {
    withAACS = true;
    withBDPlus = true;
  };
  vlc = pkgs.vlc.override { inherit libbluray; };
in
{
  environment.systemPackages = [ vlc ];
}

or overlay vlc with AACS support limited to its bluray dependency:

  nixpkgs.overlays = [
    (self: super: {
      vlc = super.vlc.override {
        libbluray = super.libbluray.override {
          withAACS = true;
          withBDplus = true;
        };
      };
    })
  ];

It is mostly about what one prefers: cleaner configuration with overlays or having the overrides immediately obvious when reading configuration.

WhittlesJr commented 5 years ago

Oh ok, I think I like your first solution best. Thank you very much!

Since this isn't terribly obvious (at least it wasn't for me), do you think that perhaps a module might be in order? Something like programs.vlc.bluRaySupport = true? Or maybe just an entry for VLC in nixos.wiki?

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
alisonjenkins commented 1 month ago

I have also just tried to get bluray playback using the overlay suggestion here and put the keydb at: ~/.config/aacs/keydb.cfg but when I try to play a bluray disc using VLC I get:

Blu-ray error:
Missing AACS configuration file!
Your input can't be opened:
VLC is unable to open the MRL 'bluray:///dev/sr0'. Check the log for details.
alisonjenkins commented 1 month ago

I have also just tried to get bluray playback using the overlay suggestion here and put the keydb at: ~/.config/aacs/keydb.cfg but when I try to play a bluray disc using VLC I get:

Blu-ray error:
Missing AACS configuration file!
Your input can't be opened:
VLC is unable to open the MRL 'bluray:///dev/sr0'. Check the log for details.

I just figured out a fix to this https://github.com/NixOS/nixpkgs/issues/75646#issuecomment-2181149542