get kodi running
This commit is contained in:
parent
d2a4f83c2e
commit
49bcdba856
|
|
@ -365,11 +365,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713077896,
|
||||
"narHash": "sha256-Noot8H0EZEAFRQWyGxh9ryvhK96xpIqKbh78X447JWs=",
|
||||
"lastModified": 1713166971,
|
||||
"narHash": "sha256-t0P/rKlsE5l1O3O2LYtAelLzp7PeoPCSzsIietQ1hSM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "630a0992b3627c64e34f179fab68e3d48c6991c0",
|
||||
"rev": "1c43dcfac48a2d622797f7ab741670fdbcf8f609",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@
|
|||
overlays = {
|
||||
kodi = final: prev: {
|
||||
kodi-standalone =
|
||||
final.kodi-wayland.passthru.withPackages
|
||||
final.kodi-wayland.withPackages
|
||||
(kodiPkgs:
|
||||
with final.kodiPackages; [
|
||||
with kodiPkgs; [
|
||||
youtube
|
||||
pvr-iptvsimple
|
||||
keymap
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
{pkgs, ...}: {
|
||||
_: {
|
||||
nix = {
|
||||
package = pkgs.nix;
|
||||
# package = pkgs.nix;
|
||||
settings = {
|
||||
substituters = [
|
||||
"http://nixcache.odie.intranet"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://cache.nixos.org/"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"nixcache.odie.intranet:2j5qAVmtBUSZMPWlIRS8Gn0Il9tbotJ9c2y43N0RLKU="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@
|
|||
services = {
|
||||
nextcloud-client.enable = lib.mkDefault true;
|
||||
udiskie = {
|
||||
settings = {
|
||||
enable = lib.mkDefault true;
|
||||
settings = {
|
||||
program_options = {
|
||||
udisks_version = 2;
|
||||
tray = true;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
{lib, ...}: with lib; {
|
||||
imports = [
|
||||
./kodi
|
||||
];
|
||||
mediacenter.kodi.enable = mkDefault true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
{vars,...}: let
|
||||
{
|
||||
vars,
|
||||
mysql,
|
||||
media,
|
||||
...
|
||||
}: let
|
||||
inherit (vars) timeZone hostName domain;
|
||||
datadirs = "smb://svartalbenheim.odie.intranet/kodi/userdata";
|
||||
mysql = {
|
||||
port = 3306;
|
||||
user = "kodi";
|
||||
pass = "kodi";
|
||||
};
|
||||
datadirs = "smb://${media.host}/kodi/userdata";
|
||||
in {
|
||||
advancedsettings = {
|
||||
addons = {
|
||||
unknownsourcecs = true;
|
||||
unknownsources = "true";
|
||||
};
|
||||
services = {
|
||||
devicename = "${hostName}.${domain}";
|
||||
webserver = true;
|
||||
webserverauthentication = false;
|
||||
webserver = "true";
|
||||
webserverauthentication = "false";
|
||||
webserverusername = "kodi";
|
||||
webserverpassword = "kodi";
|
||||
webserverport = 8000;
|
||||
webserverssl = false;
|
||||
zeroconf = true;
|
||||
wsdiscovery = true;
|
||||
upnp = true;
|
||||
upnpserver = true;
|
||||
airplay = true;
|
||||
airplayvideosupport = true;
|
||||
webserverport = "8000";
|
||||
webserverssl = "false";
|
||||
zeroconf = "true";
|
||||
wsdiscovery = "true";
|
||||
upnp = "true";
|
||||
upnpserver = "true";
|
||||
airplay = "true";
|
||||
airplayvideosupport = "true";
|
||||
};
|
||||
locale = {
|
||||
language = "resource.language.de_de";
|
||||
|
|
@ -32,19 +31,21 @@ in {
|
|||
timezone = timeZone;
|
||||
};
|
||||
lookandfeed = {
|
||||
enablerssfeeds = false;
|
||||
enablerssfeeds = "false";
|
||||
};
|
||||
videodatabase = {
|
||||
inherit (mysql) user pass host;
|
||||
type = "mysql";
|
||||
inherit (mysql) user pass port;
|
||||
port = builtins.toString mysql.port;
|
||||
};
|
||||
musicdatabase = {
|
||||
inherit (mysql) user pass host;
|
||||
type = "mysql";
|
||||
inherit (mysql) user pass port;
|
||||
port = builtins.toString mysql.port;
|
||||
};
|
||||
videolibrary = {
|
||||
importwatchedstate = true;
|
||||
importresumepoint = true;
|
||||
importwatchedstate = "true";
|
||||
importresumepoint = "true";
|
||||
};
|
||||
pathsubstitution = {
|
||||
substitute = [
|
||||
|
|
@ -68,11 +69,6 @@ in {
|
|||
from = "special://profile/favourites.xml";
|
||||
to = "${datadirs}/favourites.xml";
|
||||
}
|
||||
{
|
||||
from = "special://profile/passwords.xml";
|
||||
to = "${datadirs}/passwords.xml";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,18 +6,59 @@
|
|||
...
|
||||
}: let
|
||||
cfg = config.mediacenter.kodi;
|
||||
inherit (lib) types;
|
||||
in
|
||||
with lib; {
|
||||
options = {
|
||||
mediacenter.kodi = {
|
||||
enable = mkEnableOption "kodi";
|
||||
options.mediacenter.kodi = {
|
||||
# enable = mkEnableOption "kodi";
|
||||
media = {
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "media";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "kodi";
|
||||
};
|
||||
pass = mkOption {
|
||||
type = types.str;
|
||||
default = "kodi";
|
||||
};
|
||||
};
|
||||
mysql = {
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "localhost";
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 3306;
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "kodi";
|
||||
};
|
||||
pass = mkOption {
|
||||
type = types.str;
|
||||
default = "kodi";
|
||||
};
|
||||
};
|
||||
};
|
||||
imports = [./kodi.nix]; # import overridden kodi module
|
||||
config = mkIf cfg.enable {
|
||||
programs.kodi = {
|
||||
enable = true;
|
||||
#programs.kodi = {
|
||||
mediacenter.kodi = {
|
||||
# enable = true;
|
||||
package = pkgs.kodi-standalone;
|
||||
settings = import ./advancedsettings.nix {inherit vars;};
|
||||
settings = import ./advancedsettings.nix {inherit vars; inherit (cfg) mysql media;};
|
||||
};
|
||||
home.file = {
|
||||
"kodi-passwords.xml" = {
|
||||
target = ".kodi/userdata/passwords.xml";
|
||||
text = import ./passwords.nix {
|
||||
inherit (cfg) media;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,262 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
stylesheetCommonHeader = ''
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
|
||||
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
|
||||
<xsl:strip-space elements="*"/>
|
||||
'';
|
||||
|
||||
stylesheetCommonFooter = "</xsl:stylesheet>";
|
||||
|
||||
stylesheetNestedTags = ''
|
||||
<xsl:template match="attr[attrs]">
|
||||
<xsl:variable name="elementName" select="@name"/>
|
||||
<xsl:element name="{$elementName}">
|
||||
<xsl:apply-templates select="attrs" />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<xsl:template match="attr[list[attrs]]">
|
||||
<xsl:variable name="elementName" select="@name"/>
|
||||
<xsl:for-each select="list/attrs">
|
||||
<xsl:element name="{$elementName}">
|
||||
<xsl:apply-templates select="." />
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<xsl:template match="attr[not(attrs|list)]">
|
||||
<xsl:variable name="elementName" select="@name"/>
|
||||
<xsl:element name="{$elementName}">
|
||||
<xsl:if test="$elementName='path'">
|
||||
<!-- needed in sources.xml but will be used for all "path" tags -->
|
||||
<xsl:attribute name="pathversion">1</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="*/@value" />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
'';
|
||||
|
||||
stylesheetTagsAsSettingWithId = ''
|
||||
<xsl:template match='attr'>
|
||||
<setting>
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="@name" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="*/@value" />
|
||||
</setting>
|
||||
</xsl:template>
|
||||
'';
|
||||
|
||||
stylesheetAdvancedSettingsRootTag = ''
|
||||
<xsl:template match='/'>
|
||||
<xsl:comment> Generated by Home Manager. </xsl:comment>
|
||||
<advancedsettings version="1.0">
|
||||
<xsl:apply-templates/>
|
||||
</advancedsettings>
|
||||
</xsl:template>
|
||||
'';
|
||||
|
||||
stylesheetSourcesRootTag = ''
|
||||
<xsl:template match='/'>
|
||||
<xsl:comment> Generated by Home Manager. </xsl:comment>
|
||||
<sources>
|
||||
<xsl:apply-templates/>
|
||||
</sources>
|
||||
</xsl:template>
|
||||
'';
|
||||
|
||||
stylesheetAddonSettingsRootTag = ''
|
||||
<xsl:template match='/'>
|
||||
<xsl:comment> Generated by Home Manager. </xsl:comment>
|
||||
<settings version="2">
|
||||
<xsl:apply-templates/>
|
||||
</settings>
|
||||
</xsl:template>
|
||||
'';
|
||||
|
||||
attrsetToXml = attrs: name: stylesheet:
|
||||
pkgs.runCommand name {
|
||||
# Package splicing for libxslt does not work correctly leading to errors
|
||||
# when cross-compiling. Use the version from buildPackages explicitly to
|
||||
# fix this.
|
||||
nativeBuildInputs = [pkgs.buildPackages.libxslt.bin];
|
||||
xml = builtins.toXML attrs;
|
||||
passAsFile = ["xml"];
|
||||
} ''
|
||||
xsltproc ${stylesheet} - < "$xmlPath" > "$out"
|
||||
'';
|
||||
|
||||
attrsetToAdvancedSettingsXml = attrs: name: let
|
||||
stylesheet = builtins.toFile "stylesheet.xsl" ''
|
||||
${stylesheetCommonHeader}
|
||||
${stylesheetAdvancedSettingsRootTag}
|
||||
${stylesheetNestedTags}
|
||||
${stylesheetCommonFooter}
|
||||
'';
|
||||
in
|
||||
attrsetToXml attrs name stylesheet;
|
||||
|
||||
attrsetToSourcesXml = attrs: name: let
|
||||
stylesheet = builtins.toFile "stylesheet.xsl" ''
|
||||
${stylesheetCommonHeader}
|
||||
${stylesheetSourcesRootTag}
|
||||
${stylesheetNestedTags}
|
||||
${stylesheetCommonFooter}
|
||||
'';
|
||||
in
|
||||
attrsetToXml attrs name stylesheet;
|
||||
|
||||
attrsetToAddonSettingsXml = attrs: name: let
|
||||
stylesheet = builtins.toFile "stylesheet.xsl" ''
|
||||
${stylesheetCommonHeader}
|
||||
${stylesheetAddonSettingsRootTag}
|
||||
${stylesheetTagsAsSettingWithId}
|
||||
${stylesheetCommonFooter}
|
||||
'';
|
||||
in
|
||||
attrsetToXml attrs name stylesheet;
|
||||
in {
|
||||
meta.maintainers = [hm.maintainers.dwagenk];
|
||||
|
||||
options.mediacenter.kodi = {
|
||||
enable = mkEnableOption "Kodi";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.kodi;
|
||||
defaultText = literalExpression "pkgs.kodi";
|
||||
example =
|
||||
literalExpression
|
||||
"pkgs.kodi.withPackages (exts: [ exts.pvr-iptvsimple ])";
|
||||
description = ''
|
||||
The `kodi` package to use.
|
||||
Can be used to specify extensions.
|
||||
'';
|
||||
};
|
||||
|
||||
datadir = mkOption {
|
||||
type = types.path;
|
||||
default = "${config.home.homeDirectory}/.kodi";
|
||||
defaultText =
|
||||
literalExpression ''"''${config.home.homeDirectory}/.kodi"'';
|
||||
example = literalExpression ''"''${config.xdg.dataHome}/kodi"'';
|
||||
description = "Directory to store configuration and metadata.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with types; let
|
||||
valueType =
|
||||
oneOf [str (attrsOf valueType) (listOf valueType)]
|
||||
// {
|
||||
description = "attribute sets or lists of strings";
|
||||
};
|
||||
in
|
||||
nullOr valueType;
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
{ videolibrary.showemptytvshows = "true"; }
|
||||
'';
|
||||
description = ''
|
||||
Configuration to write to the `advancedsettings.xml`
|
||||
file in kodis userdata directory. Settings specified here will be
|
||||
immutable from inside kodi and be hidden from the GUI settings dialog.
|
||||
|
||||
See <https://kodi.wiki/view/Advancedsettings.xml> as
|
||||
reference for how settings need to be specified.
|
||||
|
||||
The innermost attributes must be of type str.
|
||||
'';
|
||||
};
|
||||
|
||||
sources = mkOption {
|
||||
type = with types; let
|
||||
valueType =
|
||||
oneOf [str (attrsOf valueType) (listOf valueType)]
|
||||
// {
|
||||
description = "attribute sets or lists of strings";
|
||||
};
|
||||
in
|
||||
nullOr valueType;
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
{
|
||||
video = {
|
||||
default = "movies";
|
||||
source = [
|
||||
{ name = "videos"; path = "/path/to/videos"; allowsharing = "true"; }
|
||||
{ name = "movies"; path = "/path/to/movies"; allowsharing = "true"; }
|
||||
];
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Contents to populate the file `sources.xml` in kodis
|
||||
userdata directory.
|
||||
|
||||
See <https://kodi.wiki/view/Sources.xml> as
|
||||
reference for how sources need to be specified.
|
||||
|
||||
Kodi will still show the dialogs to modify sources in the GUI and they
|
||||
appear to be mutable. This however is not the case and the sources will
|
||||
stay as specified via Home Manager.
|
||||
|
||||
The innermost attributes must be of type str.
|
||||
'';
|
||||
};
|
||||
|
||||
addonSettings = mkOption {
|
||||
type = with types; nullOr (attrsOf (attrsOf str));
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
{ "service.xbmc.versioncheck".versioncheck_enable = "false"; }
|
||||
'';
|
||||
description = ''
|
||||
Attribute set with the plugin namespace as toplevel key and the plugins
|
||||
settings as lower level key/value pairs.
|
||||
|
||||
Kodi will still show the settings of plugins configured via this
|
||||
mechanism in the GUI and they appear to be mutable. This however is
|
||||
not the case and the settings will stay as specified via Home Manager.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.mediacenter.kodi;
|
||||
in
|
||||
mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.kodi" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [cfg.package];
|
||||
home.sessionVariables = {KODI_DATA = cfg.datadir;};
|
||||
}
|
||||
|
||||
(mkIf (cfg.settings != null) {
|
||||
home.file."${cfg.datadir}/userdata/advancedsettings.xml".source =
|
||||
attrsetToAdvancedSettingsXml cfg.settings "kodi-advancedsettings.xml";
|
||||
})
|
||||
|
||||
(mkIf (cfg.sources != null) {
|
||||
home.file."${cfg.datadir}/userdata/sources.xml".source =
|
||||
attrsetToSourcesXml cfg.sources "kodi-sources.xml";
|
||||
})
|
||||
|
||||
(mkIf (cfg.addonSettings != null) {
|
||||
home.file = mapAttrs' (k: v:
|
||||
attrsets.nameValuePair
|
||||
"${cfg.datadir}/userdata/addon_data/${k}/settings.xml" {
|
||||
source = attrsetToAddonSettingsXml v "kodi-addon-${k}-settings.xml";
|
||||
})
|
||||
cfg.addonSettings;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{media,...}: ''
|
||||
<passwords>
|
||||
<path>
|
||||
<from>smb://${media.host}</from>
|
||||
<to>smb://${media.user}:${media.pass}@${media.host}</to>
|
||||
</path>
|
||||
</passwords>
|
||||
''
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
substituters = [
|
||||
"http://nixcache.odie.intranet"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://cache.nixos.org/"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"nixcache.odie.intranet:2j5qAVmtBUSZMPWlIRS8Gn0Il9tbotJ9c2y43N0RLKU="
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
{ config, lib, pkgs, vars, ... }:
|
||||
let
|
||||
inherit (vars) hostName;
|
||||
in
|
||||
{
|
||||
vars,
|
||||
...
|
||||
}: let
|
||||
inherit (vars) hostName domain;
|
||||
in {
|
||||
networking = {
|
||||
inherit hostName;
|
||||
inherit hostName domain;
|
||||
search = [
|
||||
domain
|
||||
"fritz.box"
|
||||
];
|
||||
firewall.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,35 @@ in
|
|||
};
|
||||
config = let
|
||||
user = "kodi";
|
||||
starter = pkgs.callPackage (
|
||||
{pkgs, kodi-standalone, ...}:
|
||||
pkgs.writeShellApplication {
|
||||
name = "kodi-launcher";
|
||||
runtimeInputs = [kodi-standalone];
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
while true
|
||||
do
|
||||
ping -c1 svartalbenheim.odie.intranet && break
|
||||
sleep 5
|
||||
done
|
||||
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 1
|
||||
kodi-standalone
|
||||
done
|
||||
'';
|
||||
}
|
||||
) {};
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
services.cage = {
|
||||
inherit user;
|
||||
enable = true;
|
||||
program = "${pkgs.kodi-standalone}/bin/kodi-standalone";
|
||||
program = "${starter}/bin/kodi-launcher";
|
||||
};
|
||||
|
||||
users.users.kodi = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,17 @@ in {
|
|||
language.base = vars.locale;
|
||||
stateVersion = "23.05";
|
||||
};
|
||||
mediacenter.kodi.enable = true;
|
||||
mediacenter.kodi = {
|
||||
enable = true;
|
||||
media = {
|
||||
host = "svartalbenheim.odie.intranet";
|
||||
pass = "Bx5sTkw1Qeg69I9!";
|
||||
};
|
||||
mysql = {
|
||||
host = "svartalbenheim.odie.intranet";
|
||||
pass = "Bx5sTkw1Qeg69I9!";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,24 @@
|
|||
outputs.homeManagerModules.development
|
||||
outputs.homeManagerModules.games
|
||||
outputs.homeManagerModules.binary-cache
|
||||
{
|
||||
services.picom.enable = false;
|
||||
];
|
||||
desktop = {
|
||||
enable = false;
|
||||
awesome.enable = false;
|
||||
pcmanfm.enable = false;
|
||||
thunar.enable = false;
|
||||
network-manager.enable = false;
|
||||
};
|
||||
programs = {
|
||||
kitty.enable = false;
|
||||
kitty.enable = true;
|
||||
keepassxc.enable = false;
|
||||
firefox.enable = false;
|
||||
};
|
||||
}
|
||||
];
|
||||
services = {
|
||||
nextcloud-client.enable = false;
|
||||
udiskie.enable = false;
|
||||
picom.enable = false;
|
||||
};
|
||||
theme.cursor.enable = false;
|
||||
theme.gtk.enable = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@
|
|||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
services.nginx.enable = true;
|
||||
services.nix-serve.enable = true;
|
||||
|
||||
home-manager.users =
|
||||
flakeLib.mkNixosHomeConfiguration {
|
||||
inherit vars system;
|
||||
|
|
|
|||
Loading…
Reference in New Issue