retronix/modules/retroarch.nix
2024-01-15 15:14:30 +01:00

32 lines
1,018 B
Nix

{ lib, pkgs, config, ...}:{
options = {
retronix.retroarch = {
settings = lib.mkOption {
description = "Global settings for retroarch instances overriden by add RetroarchConfig";
type = lib.types.attrsOf lib.types.str;
};
addRetroarchConfig = lib.mkOption {
description = "Function to append retroarch config to a rom";
type = lib.types.anything;
};
mapRetroarchConfig = lib.mkOption {
description = "Function to append retroarch config to a list of rom";
type = lib.types.anything;
};
};
};
config = {
retronix.retroarch = {
addRetroarchConfig =
{ additionalConfig ? {}, useBaseConfig ? true }: rom:
rom.override {
settings = if useBaseConfig
then config.retronix.retroarch.settings // additionalConfig
else additionalConfig;
};
mapRetroarchConfig =
args: builtins.map (config.retronix.retroarch.addRetroarchConfig args);
};
};
}