Skip to content

Instantly share code, notes, and snippets.

@fucksophie
Created June 23, 2025 12:48
Show Gist options
  • Save fucksophie/5c0eb93c5453ab2080dd583be16c0f51 to your computer and use it in GitHub Desktop.
Save fucksophie/5c0eb93c5453ab2080dd583be16c0f51 to your computer and use it in GitHub Desktop.
kodi + nixos + laptop + bluetooth

turn your old laptop into a kodi system

This configuration was written by @fucksophie, for the Lenovo Yoga 510 14ISK-80S7. I upgraded the ram in mine ages ago to 8 gigabytes instead of four. I reccomend for you to do the same.

Info:

  1. This configuration has specific configuration for fixing the S/PDIF (actually HDMI) part of the Intel HDA audio card.
    Remove them if you know that HDMI audio works with your laptop & pulseaudio. (Line 39, and lines 41-54)
  2. This has bluetooth support, remove basically anything that has bluetooth in it if you don't want that.
  3. This also uses kodi-wayland, as I had way better performance with it and a 100x easier setup via cage.
  4. PIL is broken on NixOS + Kodi, for some reason. It has been dropping out with certain configurations, and if it doesn't work for you there's a script in the tutorial.

Tutorial:

  1. Install NixOS
  2. Change sophie to your own name
  3. Change stateVersion to your own stateVersion
  4. Set your channels to use nixos-unstable
  5. sudo nixos-rebuild boot && sudo reboot now
  6. Go into root, change password for your account (via ssh)
  7. Install artic fuse 2, if PIL is broken run this
sudo -u kodi bash -c '
  mkdir -p ~/.kodi/addons/script.module.pil/lib &&
  cp -ar /nix/store/$(basename $(readlink -f $(nix eval --raw nixpkgs#python3.pkgs.pillow)))/lib/python3.*/site-packages/* ~/.kodi/addons/script.module.pil/lib/ &&
  cp -ar /nix/store/$(basename $(readlink -f $(nix eval --raw nixpkgs#kodi)))/share/kodi/addons/script.module.pil ~/.kodi/addons/
'
  1. Install other stuff like tubecast & youtube
{ config, lib, pkgs, ... }:
let
kodi-with-addons = pkgs.kodi-wayland.withPackages (kodiPkgs: with kodiPkgs; [
inputstream-adaptive
bluetooth-manager
]);
in
{
imports =
[
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
services.logind.lidSwitchExternalPower = "ignore";
networking.hostName = "laptop";
networking.networkmanager.enable = true;
systemd.sleep.extraConfig = ''
AllowSuspend=no
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no
'';
services.cage.user = "kodi";
services.cage.extraArguments = [ "-m" "last" ];
services.cage.program = "${kodi-with-addons}/bin/kodi-standalone";
services.cage.enable = true;
security.rtkit.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true; ## If compatibility with 32-bit applications is desired.
hardware.pulseaudio.extraConfig = "load-module module-alsa-sink device=hw:0,3";
systemd.services.unmute-hdmi = {
enable = true;
description = "Unmute HDMI audio at startup";
wantedBy = [ "multi-user.target" ];
unitConfig = {
After = [ "sound.target" ];
};
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.runtimeShell} -c \"sleep 15 && ${pkgs.alsa-utils}/bin/amixer -c 0 set 'IEC958',0 unmute\"";
};
};
time.timeZone = "Europe/Riga";
users.users.sophie = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "docker" "audio"]; # Enable ‘sudo’ for the user.
packages = with pkgs; [
];
};
users.users.kodi = {
isNormalUser = true;
extraGroups = [ "uucp" "audio" "input" ];
};
environment.systemPackages = with pkgs; [
nano
wget
rclone
kodi-with-addons
(python3.withPackages (ps: with ps; [ pillow ]))
alsa-utils
pavucontrol
];
services.openssh.enable = true;
networking.firewall.enable = false;
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
services.blueman.enable = true;
system.stateVersion = "24.05"; # CHANGE TO YOURS
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment