1 { config, lib, pkgs, ... }:
5 cfg = config.programs.htop;
8 if builtins.isList value then builtins.concatStringsSep " " (builtins.map fmt value) else
9 if builtins.isString value then value else
10 if builtins.isBool value then if value then "1" else "0" else
11 if builtins.isInt value then builtins.toString value else
12 throw "Unrecognized type ${builtins.typeOf value} in htop settings";
18 options.programs.htop = {
19 package = lib.mkPackageOption pkgs "htop" { };
21 enable = lib.mkEnableOption "htop process monitor";
23 settings = lib.mkOption {
24 type = with lib.types; attrsOf (oneOf [ str int bool (listOf (oneOf [ str int bool ])) ]);
27 hide_kernel_threads = true;
28 hide_userland_threads = true;
31 Extra global default configuration for htop
32 which is read on first startup only.
33 Htop subsequently uses ~/.config/htop/htoprc
34 as configuration source.
39 config = lib.mkIf cfg.enable {
40 environment.systemPackages = [
44 environment.etc."htoprc".text = ''
45 # Global htop configuration
46 # To change set: programs.htop.settings.KEY = VALUE;
47 '' + builtins.concatStringsSep "\n" (lib.mapAttrsToList (key: value: "${key}=${fmt value}") cfg.settings);