Kodi plugin with python dependencies

Hi, new-ish to NixOS here.
I’m trying to write a Nix expression for the Youtube Kodi plugin. This needs the six python package which I can’t seem to make available to the plugin. The plugin installs but then crashes at runtime with “no module named six”.
I’ve been using this as reference: https://github.com/NixOS/nixpkgs/blob/5e8c897901bdc856dec4229ea03eed2be389ab3d/pkgs/applications/video/kodi/plugins.nix
And I found this github comment on how to use this: kodiPlugins: simplify, generalize, implement kodiWithPlugins · NixOS/nixpkgs@031e1cf · GitHub
(BTW this doesn’t seem to be documented anywhere?)

This is what I have so far:

       (kodiPlugins.kodiWithPlugins (pkgs: [
         (python2Packages.toPythonModule (kodiPlugins.mkKodiPlugin rec {
  
          plugin = "youtube";
          namespace = "plugin.video.youtube";
          version = "6.6.0";
  
          src = fetchFromGitHub {
            owner = "jdf76";
            repo = namespace;
            rev = version;
            sha256 = "16pzvgb07kwj025ldpflvc7iqlhbdfn9akghv1jvb7fq4b1kgffw";
          };
 
          extraRuntimeDependencies = [
            python2Packages.six
          ];
 
          propagatedBuildInputs = [
            python2Packages.six
          ];
  
          meta = {
            homepage = http://forum.kodi.tv/showthread.php?tid=348464;
            description = "Plays YouTube videos on Kodi";
            longDescription = ''
            '';
            maintainers = with maintainers; [ ];
          };
  
        }))
       ]))

I tried both extraRuntimeDependencies and propagatedBuildInputs (I have no idea what they actually do) but no joy.

BTW this seems like a weird way of defining the list of plugins? Wouldn’t an overridable list attribute be better? If not, why?

Thanks

This worked for me.

  youtube = pkgs.python2Packages.toPythonModule (pkgs.kodiPlugins.mkKodiPlugin rec {
    plugin = "youtube";
    namespace = "plugin.video.youtube";
    version = "6.8.3";
    src = pkgs.fetchFromGitHub {
      owner = "jdf76";
      repo = namespace;
      rev = "${version}";
      sha256 = "07cm1ik4c2g1vdma15aj72zbnk2yypl4v5h4vb52mg331p0d0kg1";
    };
    meta = {
      homepage = src.meta.homepage;
      description = "Seren";
      license = lib.licenses.gpl3;
    };
    propagatedBuildInputs = [
      pkgs.python2Packages.six
      pkgs.python2Packages.requests
      unstable.kodiPlugins.inputstreamhelper
    ];
  });
2 Likes

kodi has been reworked a fair bit for 21.05. I’ll go ahead and package the youtube plugin so you will be able to use it like this:

environment.systemPackages = with pkgs; [
  (kodi.withPackages (p: with p; [ youtube ]))
];
1 Like

https://github.com/NixOS/nixpkgs/pull/119669

Thanks! Since I posted my original message here I did manage to wrap up the Youtube plugin but I forgot to post back here or submit a PR.