mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
rio: reformat
This commit is contained in:
parent
9d6e28fd32
commit
a5fee07792
1 changed files with 40 additions and 27 deletions
|
|
@ -5,22 +5,34 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
mkIf
|
||||||
|
mkMerge
|
||||||
|
types
|
||||||
|
literalExpression
|
||||||
|
mapAttrs'
|
||||||
|
nameValuePair
|
||||||
|
;
|
||||||
|
|
||||||
cfg = config.programs.rio;
|
cfg = config.programs.rio;
|
||||||
|
|
||||||
settingsFormat = pkgs.formats.toml { };
|
settingsFormat = pkgs.formats.toml { };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.programs.rio = {
|
options.programs.rio = {
|
||||||
enable = lib.mkEnableOption null // {
|
enable = mkEnableOption null // {
|
||||||
description = ''
|
description = ''
|
||||||
Enable Rio, a terminal built to run everywhere, as a native desktop applications by
|
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.
|
Rust/WebGPU or even in the browsers powered by WebAssembly/WebGPU.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "rio" { nullable = true; };
|
package = mkPackageOption pkgs "rio" { nullable = true; };
|
||||||
|
|
||||||
settings = lib.mkOption {
|
settings = mkOption {
|
||||||
type = settingsFormat.type;
|
type = settingsFormat.type;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
|
|
@ -29,15 +41,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
themes = lib.mkOption {
|
themes = mkOption {
|
||||||
type = with lib.types; attrsOf (either settingsFormat.type path);
|
type = with types; attrsOf (either settingsFormat.type path);
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Theme files written to {file}`$XDG_CONFIG_HOME/rio/themes/`. See
|
Theme files written to {file}`$XDG_CONFIG_HOME/rio/themes/`. See
|
||||||
<https://rioterm.com/docs/config#building-your-own-theme> for
|
<https://rioterm.com/docs/config#building-your-own-theme> for
|
||||||
supported values.
|
supported values.
|
||||||
'';
|
'';
|
||||||
example = lib.literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
foobar.colors = {
|
foobar.colors = {
|
||||||
background = "#282a36";
|
background = "#282a36";
|
||||||
|
|
@ -50,27 +62,28 @@ in
|
||||||
};
|
};
|
||||||
meta.maintainers = [ lib.maintainers.otavio ];
|
meta.maintainers = [ lib.maintainers.otavio ];
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable (
|
config = mkIf cfg.enable (mkMerge [
|
||||||
lib.mkMerge [
|
{
|
||||||
{
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Only manage configuration if not empty
|
# Only manage configuration if not empty
|
||||||
(lib.mkIf (cfg.settings != { }) {
|
(mkIf (cfg.settings != { }) {
|
||||||
xdg.configFile."rio/config.toml".source =
|
xdg.configFile."rio/config.toml".source =
|
||||||
if lib.isPath cfg.settings then cfg.settings else settingsFormat.generate "rio.toml" cfg.settings;
|
if builtins.isPath cfg.settings then
|
||||||
})
|
cfg.settings
|
||||||
|
else
|
||||||
|
settingsFormat.generate "rio.toml" cfg.settings;
|
||||||
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.themes != { }) {
|
(mkIf (cfg.themes != { }) {
|
||||||
xdg.configFile = lib.mapAttrs' (
|
xdg.configFile = mapAttrs' (
|
||||||
name: value:
|
name: value:
|
||||||
lib.nameValuePair "rio/themes/${name}.toml" {
|
nameValuePair "rio/themes/${name}.toml" {
|
||||||
source =
|
source =
|
||||||
if builtins.isPath value then value else settingsFormat.generate "rio-theme-${name}.toml" value;
|
if builtins.isPath value then value else settingsFormat.generate "rio-theme-${name}.toml" value;
|
||||||
}
|
}
|
||||||
) cfg.themes;
|
) cfg.themes;
|
||||||
})
|
})
|
||||||
]
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue