add themes

This commit is contained in:
sinavir 2024-01-17 13:37:12 +01:00
parent 2aa1156a25
commit 9f8994f4d2
2 changed files with 21 additions and 2 deletions

View file

@ -9,7 +9,7 @@ in
{ {
retronix = { retronix = {
systems = { systems = {
"Arcade" = { "arcade" = {
extension = ".sh"; extension = ".sh";
games = with pkgs.roms; mapRetroarchConfig {} [ games = with pkgs.roms; mapRetroarchConfig {} [
atetris atetris
@ -24,6 +24,14 @@ in
emulationstation = { emulationstation = {
inputCfgFile = mkFile "es_input.cfg" ./es_input.cfg; inputCfgFile = mkFile "es_input.cfg" ./es_input.cfg;
settingsCfgFile = mkFile "es_settings.cfg" ./es_settings.cfg; settingsCfgFile = mkFile "es_settings.cfg" ./es_settings.cfg;
themes = {
"ComicBook" = pkgs.fetchFromGitHub {
owner = "TMNTturtleguy";
repo = "es-theme-ComicBook";
rev = "master";
hash = "sha256-Mma7/5osIvTdTM8Z0vkJBW/4p3O6wms6nBApxB7+IiA=";
};
};
}; };
}; };
} }

View file

@ -61,7 +61,7 @@ let
symlinkCommands = builtins.map ( symlinkCommands = builtins.map (
v: "ln -s ${v}/${v.launchPath} $out/${v.name}.sh" v: "ln -s ${v}/${v.launchPath} $out/${v.name}.sh"
) games; ) games;
in pkgs.runCommand "${name}-roms" { in pkgs.runCommand "${name}-roms" {
inherit gamelist symlinkCommands; inherit gamelist symlinkCommands;
passAsFile = [ passAsFile = [
@ -121,6 +121,10 @@ in {
themesDir = lib.mkOption { themesDir = lib.mkOption {
type = lib.types.path; type = lib.types.path;
}; };
themes = lib.mkOption {
type = lib.types.attrsOf lib.types.path;
default = {};
};
inputCfg = lib.mkOption { inputCfg = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
@ -157,6 +161,12 @@ in {
</systemList> </systemList>
''; '';
inputCfgFile = lib.mkDefault (pkgs.writeTextDir "es_input.cfg" cfg.inputCfg); inputCfgFile = lib.mkDefault (pkgs.writeTextDir "es_input.cfg" cfg.inputCfg);
themesDir = let
copyCommands = lib.concatLines (lib.mapAttrsToList (k: v: "cp -r ${v} $out/themes/${k}") cfg.themes);
in pkgs.runCommand "es-themes" {} ''
mkdir -p $out/themes
${copyCommands}
'';
homeDir = pkgs.symlinkJoinSubdir { homeDir = pkgs.symlinkJoinSubdir {
name = "es-config-dir"; name = "es-config-dir";
subdir = ".emulationstation"; subdir = ".emulationstation";
@ -164,6 +174,7 @@ in {
cfg.systemCfgFile cfg.systemCfgFile
cfg.inputCfgFile cfg.inputCfgFile
cfg.settingsCfgFile cfg.settingsCfgFile
cfg.themesDir
] ++ cfg.extraConfigFiles; ] ++ cfg.extraConfigFiles;
}; };
cli = pkgs.writeScript "emulationstation" "${pkgs.emulationstationPatched}/bin/emulationstation --home ${cfg.homeDir} --gamelist-only"; cli = pkgs.writeScript "emulationstation" "${pkgs.emulationstationPatched}/bin/emulationstation --home ${cfg.homeDir} --gamelist-only";