Yep, that’s the problem.
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.