So, I’ve been using NixOS for a bit now, but I’m pretty confused about getting Kodi to work. I’m also new to Kodi, so its likely that I’m doing something wrong.
I have the following file: kodi.nix which I’m importing to configuration.nix.
However, I see no plugins on the interface. There seems to be conflicting documentation on the NixOS wiki vs. some GitHub issues like these.
I used the netflix plugin for roughly 10 months and found it to be reasonably stable. Sometimes kodi just randomly crashes, but all my htpc boxes launch kodi as a systemd user service that have automatic restarts enabled so a crash in the menu isn’t a huge deal.
Every once in a while I wonder what it would take for me to switch from kodi to something else but cec integration combined with my steam plugin really makes kodi unbeatable for my family… so we just live with the occasional crash once in a while
I’ve even been debating just going for something like XFCE and using a bluetooth mouse/touchpad as a remote. With some optimizations (onscreen keyboards etc.), I believe a setup like that could even offer tremendous flexibility without having to deal with Kodi (and all the plugins that have not really been stable for me, at least).
kodi isn’t a magic globally available variable (the only such variable in nix land is builtins), it’s stored inside of the pkgs that is passed as an argument to your module (where you write { config, pkgs, ... }:) - NixOS handles handing the pkgs variable to your module, but it’s up to you to use it correctly.
So when you type kodi.withPackages, nix has no idea what you mean, because kodi does not exist.
There are three ways to access the variable:
Instead of using kodi, use pkgs.kodi, that will take the kodi attribute in pkgs and simply use it.
In this case, you should probably do that.
At the very top of the file, after you define your inputs, use let inherit (pkgs) kodi; in, that will copy the kodi out of pkgs and make it available as kodi directly
This is useful for library functions
You can use with pkgs; to make all variables inside pkgs available within the next expression
You already do that with environment.systemPackages as well as in the kodi.withPackages call, but it’s best avoided when you do anything but list packages to install.
So in this case, just change your line to:
services.xserver.desktopManager.kodi.package = pkgs.kodi.withPackages (pkgs: with pkgs; [ osmc-skin ]);
Another side note from me, when you use a definition like services.xserver.desktopManager.kodi.enable, or programs.steam.enable, that package will already be installed.
Also adding it to environment.systemPackages at best does nothing, but at worst it will cause you to use the wrong package and just break. I believe that steam should not be working for you in some cases, for example.
(Hi there! forgive me if I’m necroposting here, but I think it is better to continue the conversation here instead of scattering information around…)
I just installed kodi in wayland as per the wiki, and used the paragraph after that to install the plugins. In there, the second option is to add them to environment.systemPackages, they don’t show up as already reported by others.
Are the two options of using home manager and xserver.desktopManager my only choices?
I would have preferred to stay with wayland and not use home-manager since it is an HTPC with no “real” user access
OK, I just moved to home-manager to be able to configure kodi and enable the web server.
Addons gets installed in the /nix/store folder, but I still don’t see any plugin in the kodi interface.
looking at the kodi log, I can see that the addons folder is set to a non existing one:
info <general>: special://xbmcbinaddons/ is mapped to: /nix/store/dhxbrm5xrzz1rgcmc8fzx82qywmkxixx-kodi-20.5/lib/kodi/addons
...
error <general>: GetDirectory - Error getting /nix/store/dhxbrm5xrzz1rgcmc8fzx82qywmkxixx-kodi-20.5/lib/kodi/addons
I might have overlooked that, but I’m pretty sure that the only option was to install them and not enable them.
I tried to switch to the xserver.desktopManager config, and at the next boot I got kodi asking me to enable the plugins.
The log still complains about the missing addin folder, so I presume this is not the cause of kodi-wayland not loading the plugins.
At this point I’m worried I’m overlaying too many things on the running system, it’s better if I start from scratch with a VM to do more thorough testing.
i am one of the kodi maintainers so please keep me up to date on this and if you continue to have problems then let’s move this to a gothub issue with a reproducible example
OK, I’ve got it working using home manager, kodi-gbm and a user systemd service!
Not sure what caused to finally detect the addons since I suppose I missed some reboots between tries…
For posterity, here’s the home manager config that worked
I had never looked at the home manager kodi module until you mentioned it. I see they offer settings… very nice. I’ll have to look into that for the NixOS module.