Right way to install Kodi and plugins?

Hi, all. I’m having trouble with this as well. I see that sanzoghenzo solved it by switching to home manager, but I’m trying to solve this by sticking with a global config if possible (I’d like to tackle home manager as a future project).

My system is configured to auto-login into LXQt and then start kodi, rather than using kodi-standalone. I’m trying to install plugins as shown on the wiki page:

  environment.systemPackages = with pkgs; [
    kodi
    (pkgs.kodi.withPackages (kodiPkgs: with kodiPkgs; [
      pvr-hdhomerun
      youtube
    ]))
<SNIP>
  ];

This seems to build and install properly, however these plugins do not show up in my list of installed plugins (and I’m not prompted to activate them). I don’t particularly care about youtube because I can install that via kodi itself, but the PVR plugin must be installed via a system package, or I try to compile and install it myself (which I also don’t know how to do on nix).

Should this config work? I’m not sure if I’m doing something wrong (my initial assumption), or if the documentation on the wiki is incorrect.

Would appreciate any guidance. Thanks.

remove the first kodi from your list - you’re installing 2 different kodi binaries so the vanilla one without addons is probably clobbering the one with

1 Like

@aanderse - thank you! That was exactly the problem. I didn’t realize that code to install plugins would also install kodi itself.

Unfortunately the PVR client doesn’t seem to be usable for some reason, but it’s at least recognized by kodi and installed now, so I’ll troubleshoot that issue separately. Thanks a bunch for the help.

@aanderse - I’ve been digging into that issue I mentioned previous and I’m trying to rule out whether this is a packaging issue. What’s happening is the hdhomerun client does show up in my list of installed addons, and I can configure it, disable it, etc. like any other add-on.

But, when accessing the PVR / Live TV interface it just doesn’t see it. By that I mean it shows no channels and doesn’t let me search for channels, and when going into the OVR & Live TV settings, selceting PVR client add-ons just shows an empty list.

I see this in the kodi logs:

2024-05-27 14:45:07.932 T:1600    error <general>: GetDirectory - Error getting /nix/store/mgi1hccif2bfy72chdzpi6gaq1rif51j-kodi-20.5/lib/kodi/addons 
2024-05-27 14:45:07.932 T:1600    error <general>: GetDirectory - Error getting special://xbmcbin/addons

/nix/store/mgi1hccif2bfy72chdzpi6gaq1rif51j-kodi-20.5/lib/kodi/ exists, but there’s no addons directory. pvr-hdhome seems to be installed under /nix/store/aw1csvnsspsqndfnfh25nimdvfvmw33a-kodi-pvr-hdhomerun-20.4.0/lib/addons/ instead.

But, later in the logs I see this:

2024-05-27 14:45:07.941 T:1600     info <general>: CAddonMgr::FindAddons: pvr.hdhomerun v20.4.0 installed
<SNIP>
2024-05-27 14:45:09.243 T:1642     info <general>: AddOnLog: pvr.hdhomerun: Create - Creating the PVR HDHomeRun add-on
2024-05-27 14:45:09.664 T:1642     info <general>: PVR Manager: Starting
2024-05-27 14:45:09.713 T:1669     info <general>: PVR Manager: Started

So I’m confused now. Kodi clearly see’s something. Was that first message red herring because it’s looking in multiple paths for addons? That would make sense… but if it seens the addon, when why is PVR functionality not working?

Any ideas? Like I said, mostly trying to rule out whether this is a packaging issue, and if so I’ll go ask for support on the kodi forum.

(I did, btw, confirm that my hdhomerun device is working as expected. Playing a a stream directly from it works fine.)

i just watched some videos to discover what this addon is and that it requires some hardware

let’s move this to a github issue - please ping me and we can continue there

hopefully another member of the kodi team has this hardware because i do not … though it seems like it might be a good gift for my dad :sweat_smile:

1 Like

Hey guys! Is there a (convinient) way to use Nix to install plugins that are not yet in nixpkgs?
Because I use Nix for quite some time now and I don’t want to go back to traditional ways of managing plugins in any program ever again ^^

what plugin? did you already package it?

I did not package anything yet. I was looking through nixpkgs to find plugins for Disney+ and Amazon Prime Video and haven’t found any (maybe i was not paying enough attention). I was hoping that there might be a option in home-manager or something to use plugins on GitHub that have not already been packaged by someone else (yet).

no, nothing like that

just post here or file an issue on github and someone on the team might get around to it

Hi @aanderse, did you by any chance took a look at it?

It seems that my latest update of nixos-unstable (and with it kodi 21.1) broke the kodi startup (and something else), so I was wondering if I could remove one layer of complexity (home manager and user services) while keeping the declarative config.

I’m willing to contribute to this, do you have any pointers (just to not strating from scratch by analysing nixpkgs line by line :sweat_smile: )?

i did! and it was so incredibly helpful for me :smiley:

i ended up creating a services.kodi module which is intended to start at user login and remain running forever - it supports the following options: enable, package (used to specify addons), openFirewall, and settings (for advancedsettings.xml)

you can check it out here along with how i use it via a custom profiles.htpc module i wrote


it would probably be a good idea to incorporate this into the services.xserver.desktopManager.kodi module… but i need at least a simple window manager (for steam) so don’t use that module and haven’t been motivated to work on that

1 Like

Nice!
I see that you pass the advancedsettings.xml file as parameter, and you didn’t port the other settings files.
I’m trying to do that, and I’ve come up with this after looking around for solutions on how to save/link files to an out-of store directory, but it obviously doesn’t work: my advancedsettings.xml file doesn’t get linked to /var/lib/kodi (the default dataDir folder I added to the options), and I’m not sure it is even written in the store (how to check this?).
Do you see any big mistakes in my module?
Thank you as always for your help

awesome!

your issue is that you’re using mkIf inside a list - instead you should concatenate additional items to the list with optionals like so:

    systemd.tmpfiles.rules = [
      "d ${cfg.dataDir} 0750 ${cfg.user} ${cfg.group} - -"
      "Z ${cfg.dataDir} - ${cfg.user} ${cfg.group} - -"
    ] ++ lob.optionals (cfg.settings != null) [
      "L+ ${cfg.dataDir}/userdata/advancedsettings.xml - - - - ${attrsetToAdvancedSettingsXml cfg.settings "kodi-advancedsettings.xml"}"
    ] ++ lib.optionals (cfg.sources != null) [
      "L+ ${cfg.dataDir}/userdata/sources.xml - - - - ${attrsetToSourcesXml cfg.sources "kodi-sources.xml"}"
    ];

Thanks! I definitely need to learn nix basics and lib functions :sweat_smile:

I’ve got it up and running, and in the process I found out that my startup problems were caused by me adding the kmscon service while stealing other users configs, so totally unrelated with home-manager or nixpkgs :sweat_smile:

But this works was not for nothing, now I can use deploy-rs to update my htpc box on the fly (before I had to use the --boot flag and reboot it manually because of errors in the activation of services)!

I’ll try to convert my old addons configs to nix configs, and if successful I’ll post the updated version of my kodi mudule

1 Like

Here you are, this version should correctly create the add-ons settings.
I stopped translating my files when I realized that I need to pass all the config and not only the overrides from default, and also because some of the add-ons needs write access to store temporary/always changing info (like jellyfin’s “LastIncrementalSync”).

1 Like