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.