htop: replace individual option with 'settings' (#1844)
* htop: add some missing meters * htop: replace individual options with 'settings' Deprecate all options and introduce `settings` for setting htop configuration values in Nix configuration. Use `lib.htop` to provide `fields` and `modes` for easy access to htop's integer configuration. And `leftMeters` and `rightMeters` functions for building the separate `*_meters` and `*_meter_modes` attributes. * htop: add release-notes 21.05 entry * htop: improve deprecation warnings Move default configuration into `settings` and make deprecated options default to `null`. Print deprecation warnings for any option that is non-null -- i.e. only show warnings for explicitly specified deprecated options. * htop: make self code owner of module * release notes: fix invalid programs.htop xref
This commit is contained in:
parent
ff616b2734
commit
91450f23ce
7 changed files with 450 additions and 130 deletions
13
tests/modules/programs/htop/default-settings.nix
Normal file
13
tests/modules/programs/htop/default-settings.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.htop.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/htop/htoprc
|
||||
'';
|
||||
};
|
||||
}
|
||||
4
tests/modules/programs/htop/default.nix
Normal file
4
tests/modules/programs/htop/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
htop-default-settings = ./default-settings.nix;
|
||||
htop-example-settings = ./example-settings.nix;
|
||||
}
|
||||
47
tests/modules/programs/htop/example-settings.nix
Normal file
47
tests/modules/programs/htop/example-settings.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.htop.enable = true;
|
||||
programs.htop.settings = {
|
||||
color_scheme = 6;
|
||||
cpu_count_from_one = 0;
|
||||
delay = 15;
|
||||
fields = with config.lib.htop.fields; [
|
||||
PID
|
||||
USER
|
||||
PRIORITY
|
||||
NICE
|
||||
M_SIZE
|
||||
M_RESIDENT
|
||||
M_SHARE
|
||||
STATE
|
||||
PERCENT_CPU
|
||||
PERCENT_MEM
|
||||
TIME
|
||||
COMM
|
||||
];
|
||||
highlight_base_name = 1;
|
||||
highlight_megabytes = 1;
|
||||
highlight_threads = 1;
|
||||
} // (with config.lib.htop;
|
||||
leftMeters {
|
||||
AllCPUs2 = modes.Bar;
|
||||
Memory = modes.Bar;
|
||||
Swap = modes.Bar;
|
||||
Zram = modes.Text;
|
||||
}) // (with config.lib.htop;
|
||||
rightMeters {
|
||||
Tasks = modes.Text;
|
||||
LoadAverage = modes.Text;
|
||||
Uptime = modes.Text;
|
||||
Systemd = modes.Text;
|
||||
});
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/htop/htoprc
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue