mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
modules/terminal: restrict colornames
This commit is contained in:
parent
f05bfc132d
commit
ec5d7f4ccc
1 changed files with 14 additions and 0 deletions
|
|
@ -6,6 +6,10 @@
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.terminal;
|
cfg = config.terminal;
|
||||||
|
validColornames =
|
||||||
|
[ "background" "foreground" "cursor" ] ++
|
||||||
|
(builtins.map (n: "color${builtins.toString n}") (lib.lists.range 0 15));
|
||||||
|
validColorname = colorName: builtins.elem colorName validColornames;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
###### interface
|
###### interface
|
||||||
|
|
@ -34,6 +38,8 @@ in
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
Colorscheme used for the terminal.
|
Colorscheme used for the terminal.
|
||||||
|
Acceptable attribute names are:
|
||||||
|
`background`, `foreground`, `cursor` and `color0`-`color15`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -42,6 +48,14 @@ in
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
assertions = [{
|
||||||
|
assertion = builtins.all validColorname (attrNames cfg.colors);
|
||||||
|
message = ''
|
||||||
|
`terminal.colors` only accepts the following attributes:
|
||||||
|
`background`, `foreground`, `cursor` and `color0`-`color15`.
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
|
||||||
build.activation =
|
build.activation =
|
||||||
let
|
let
|
||||||
fontPath =
|
fontPath =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue