From 459169b9b8b811243c8fd9a6718d44be662556b2 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 2 Feb 2022 22:52:40 +0100 Subject: [PATCH] Migrate htop configuration to home-manager There is a module for htop, so use that one instead of home.file. The cool thing is: It has "constants" for some strange integer values. So nix version is actually readable while the generated config is strange. That's a cool pro of nix files. --- home.nix | 9 ++++--- home/programs/htop.nix | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 home/programs/htop.nix diff --git a/home.nix b/home.nix index 1c32e07..69526b9 100644 --- a/home.nix +++ b/home.nix @@ -19,6 +19,9 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; + # Install packages + # Some are installed via `programs` below, as they are also configured. + # Some packages don't have a module for configuration, and are configured via `home.file` below. home.packages = [ pkgs.nix pkgs.cacert @@ -29,9 +32,6 @@ pkgs.dunst pkgs.i3lock-color - # System monitoring - pkgs.htop - # Dev tools pkgs.litecli pkgs.mycli @@ -51,6 +51,9 @@ git = import ./home/programs/git.nix { inherit pkgs; }; + htop = import ./home/programs/htop.nix { + inherit config; + }; }; home.file = { diff --git a/home/programs/htop.nix b/home/programs/htop.nix new file mode 100644 index 0000000..7a884a7 --- /dev/null +++ b/home/programs/htop.nix @@ -0,0 +1,53 @@ +{ config }: + +{ + enable = true; + settings = { + delay = 15; + + color_scheme = 0; + tree_view = 0; + + 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 = 0; + highlight_megabytes = 1; + highlight_threads = 1; + + show_thread_names = 0; + show_program_path = 1; + + hide_threads = 0; + hide_kernel_threads = 1; + hide_userland_threads = 0; + + sort_key = 47; + sort_direction = 1; + + } // (with config.lib.htop; leftMeters [ + (bar "LeftCPUs") + (bar "Memory") + (bar "Swap") + (text "Zram") + (text "Systemd") + ]) // (with config.lib.htop; rightMeters [ + (bar "RightCPUs") + (text "Tasks") + (text "LoadAverage") + (text "Uptime") + (text "Battery") + ]); +}