33 lines
1,018 B
Nix
33 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);
|
||
|
};
|
||
|
};
|
||
|
}
|