From a49fa9acb2617129f216f04580b8c423095d2a33 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 31 Aug 2024 12:42:28 +0000 Subject: [PATCH] hmMod/extends: add retroarch settings enable & cores --- nix/hmModules/extends/default.nix | 1 + nix/hmModules/extends/retroarch.nix | 43 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 nix/hmModules/extends/retroarch.nix diff --git a/nix/hmModules/extends/default.nix b/nix/hmModules/extends/default.nix index ff0ff8f..d1ec743 100644 --- a/nix/hmModules/extends/default.nix +++ b/nix/hmModules/extends/default.nix @@ -2,6 +2,7 @@ imports = [ # files ./kdeconnect.nix + ./retroarch.nix ./vscode.nix ]; } diff --git a/nix/hmModules/extends/retroarch.nix b/nix/hmModules/extends/retroarch.nix new file mode 100644 index 0000000..59b59ce --- /dev/null +++ b/nix/hmModules/extends/retroarch.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.retroarch; +in +{ + options.programs.retroarch = { + + enable = lib.mkEnableOption "RetroArch as user program"; + + package = lib.mkPackageOption pkgs "retroarch" { + example = lib.literalExpression "pkgs.retroarchFull"; + }; + + cores = lib.mkOption { + description = "List of cores to install."; + type = lib.types.listOf lib.types.package; + default = [ ]; + example = lib.literalExpression "with pkgs.libretro; [ twenty-fortyeight ]"; + }; + + finalPackage = lib.mkOption { + description = "RetroArch package with the cores selected"; + type = lib.types.package; + readOnly = true; + default = if cfg.cores == [ ] then cfg.package else cfg.package.override { inherit (cfg) cores; }; + defaultText = '' + with config.programs.retroarch; + package.override { inherit cores; } + ''; + }; + + }; + config = { + + home.packages = lib.singleton cfg.finalPackage; + + }; +}