mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00: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:
parent
e63a6b3479
commit
f092a92202
8 changed files with 116 additions and 0 deletions
|
@ -299,6 +299,12 @@
|
|||
github = "nurelin";
|
||||
githubId = 5276274;
|
||||
};
|
||||
otavio = {
|
||||
email = "otavio.salvador@ossystems.com.br";
|
||||
github = "otavio";
|
||||
githubId = 25278;
|
||||
name = "Otavio Salvador";
|
||||
};
|
||||
pltanton = {
|
||||
name = "pltanton";
|
||||
email = "plotnikovanton@gmail.com";
|
||||
|
|
|
@ -1221,6 +1221,15 @@ in
|
|||
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.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -178,6 +178,7 @@ let
|
|||
./programs/qutebrowser.nix
|
||||
./programs/rbw.nix
|
||||
./programs/readline.nix
|
||||
./programs/rio.nix
|
||||
./programs/ripgrep.nix
|
||||
./programs/rofi-pass.nix
|
||||
./programs/rofi.nix
|
||||
|
|
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;
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -124,6 +124,7 @@ import nmt {
|
|||
./modules/programs/qcal
|
||||
./modules/programs/qutebrowser
|
||||
./modules/programs/readline
|
||||
./modules/programs/rio
|
||||
./modules/programs/ripgrep
|
||||
./modules/programs/rtx
|
||||
./modules/programs/sagemath
|
||||
|
|
4
tests/modules/programs/rio/default.nix
Normal file
4
tests/modules/programs/rio/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
rio-example-settings = ./example-settings.nix;
|
||||
rio-empty-settings = ./empty-settings.nix;
|
||||
}
|
11
tests/modules/programs/rio/empty-settings.nix
Normal file
11
tests/modules/programs/rio/empty-settings.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
_:
|
||||
|
||||
{
|
||||
programs.rio.enable = true;
|
||||
|
||||
test.stubs.rio = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/rio
|
||||
'';
|
||||
}
|
32
tests/modules/programs/rio/example-settings.nix
Normal file
32
tests/modules/programs/rio/example-settings.nix
Normal 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}'
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue