2024-01-05 11:06:15 +00:00
|
|
|
{ lib, pkgs, config, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.programs.rio;
|
|
|
|
|
|
|
|
settingsFormat = pkgs.formats.toml { };
|
|
|
|
in {
|
|
|
|
options.programs.rio = {
|
|
|
|
enable = lib.mkEnableOption null // {
|
2024-06-04 18:23:39 +00:00
|
|
|
description = ''
|
2024-01-05 11:06:15 +00:00
|
|
|
Enable Rio, a terminal built to run everywhere, as a native desktop applications by
|
|
|
|
Rust/WebGPU or even in the browsers powered by WebAssembly/WebGPU.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
package = lib.mkPackageOption pkgs "rio" { };
|
|
|
|
|
|
|
|
settings = lib.mkOption {
|
|
|
|
type = settingsFormat.type;
|
|
|
|
default = { };
|
|
|
|
description = ''
|
2024-06-04 18:23:39 +00:00
|
|
|
Configuration written to {file}`$XDG_CONFIG_HOME/rio/config.toml`. See
|
|
|
|
<https://raphamorim.io/rio/docs/#configuration-file> for options.
|
2024-01-05 11:06:15 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
meta.maintainers = [ lib.maintainers.otavio ];
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
{
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
}
|
|
|
|
|
|
|
|
# Only manage configuration if not empty
|
2024-06-04 18:23:39 +00:00
|
|
|
(lib.mkIf (cfg.settings != { }) {
|
2024-01-05 11:06:15 +00:00
|
|
|
xdg.configFile."rio/config.toml".source = if lib.isPath cfg.settings then
|
|
|
|
cfg.settings
|
|
|
|
else
|
|
|
|
settingsFormat.generate "rio.toml" cfg.settings;
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
}
|