programs.rio: add module (#4118)
Adds a programs.rio module to control Rio installation and configuration, a gpu accelerated terminal Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
This commit is contained in:
parent
e63a6b3479
commit
f092a92202
8 changed files with 116 additions and 0 deletions
52
modules/programs/rio.nix
Normal file
52
modules/programs/rio.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
cfg = config.programs.rio;
|
||||
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||
in {
|
||||
options.programs.rio = {
|
||||
enable = lib.mkEnableOption null // {
|
||||
description = lib.mdDoc ''
|
||||
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 = ''
|
||||
Configuration written to <filename>$XDG_CONFIG_HOME/rio/config.toml</filename> on Linux or
|
||||
<filename>$HOME/Library/Application Support/rio/config.toml</filename> on Darwin. See
|
||||
<link xlink:href="https://raphamorim.io/rio/docs/#configuration-file"/> for options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
meta.maintainers = [ lib.maintainers.otavio ];
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{
|
||||
home.packages = [ cfg.package ];
|
||||
}
|
||||
|
||||
# Only manage configuration if not empty
|
||||
(lib.mkIf (cfg.settings != { } && !isDarwin) {
|
||||
xdg.configFile."rio/config.toml".source = if lib.isPath cfg.settings then
|
||||
cfg.settings
|
||||
else
|
||||
settingsFormat.generate "rio.toml" cfg.settings;
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.settings != { } && isDarwin) {
|
||||
home.file."Library/Application Support/rio/config.toml".source =
|
||||
if lib.isPath cfg.settings then
|
||||
cfg.settings
|
||||
else
|
||||
settingsFormat.generate "rio.toml" cfg.settings;
|
||||
})
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue