1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

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:
Otavio Salvador 2023-09-18 17:42:22 -03:00 committed by GitHub
parent e63a6b3479
commit f092a92202
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 116 additions and 0 deletions

View file

@ -299,6 +299,12 @@
github = "nurelin"; github = "nurelin";
githubId = 5276274; githubId = 5276274;
}; };
otavio = {
email = "otavio.salvador@ossystems.com.br";
github = "otavio";
githubId = 25278;
name = "Otavio Salvador";
};
pltanton = { pltanton = {
name = "pltanton"; name = "pltanton";
email = "plotnikovanton@gmail.com"; email = "plotnikovanton@gmail.com";

View file

@ -1221,6 +1221,15 @@ in
A new module is available: 'programs.eza'. A new module is available: 'programs.eza'.
''; '';
} }
{
time = "2023-09-18T11:44:11+00:00";
message = ''
A new module is available: 'programs.rio'.
Rio is a hardware-accelerated GPU terminal emulator powered by WebGPU.
'';
}
]; ];
}; };
} }

View file

@ -178,6 +178,7 @@ let
./programs/qutebrowser.nix ./programs/qutebrowser.nix
./programs/rbw.nix ./programs/rbw.nix
./programs/readline.nix ./programs/readline.nix
./programs/rio.nix
./programs/ripgrep.nix ./programs/ripgrep.nix
./programs/rofi-pass.nix ./programs/rofi-pass.nix
./programs/rofi.nix ./programs/rofi.nix

52
modules/programs/rio.nix Normal file
View 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;
})
]);
}

View file

@ -124,6 +124,7 @@ import nmt {
./modules/programs/qcal ./modules/programs/qcal
./modules/programs/qutebrowser ./modules/programs/qutebrowser
./modules/programs/readline ./modules/programs/readline
./modules/programs/rio
./modules/programs/ripgrep ./modules/programs/ripgrep
./modules/programs/rtx ./modules/programs/rtx
./modules/programs/sagemath ./modules/programs/sagemath

View file

@ -0,0 +1,4 @@
{
rio-example-settings = ./example-settings.nix;
rio-empty-settings = ./empty-settings.nix;
}

View file

@ -0,0 +1,11 @@
_:
{
programs.rio.enable = true;
test.stubs.rio = { };
nmt.script = ''
assertPathNotExists home-files/.config/rio
'';
}

View file

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
path = if isDarwin then
"Library/Application Support/rio/config.toml"
else
".config/rio/config.toml";
expected = pkgs.writeText "rio-expected.toml" ''
cursor = "_"
padding-x = 0
performance = "Low"
'';
in {
programs.rio = {
enable = true;
package = config.lib.test.mkStubPackage { };
settings = {
cursor = "_";
performance = "Low";
padding-x = 0;
};
};
nmt.script = ''
assertFileExists home-files/"${path}"
assertFileContent home-files/"${path}" '${expected}'
'';
}