summary refs log tree commit diff
path: root/nixos/modules/programs/atop.nix
blob: 7fdaab9d67dfe374942b7bb83229d6ad1521380f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Global configuration for atop.

{config, pkgs, ...}:

with pkgs.lib;

let cfg = config.programs.atop;

in
{
  ###### interface

  options = {

    programs.atop = {

      settings = mkOption {
        type = types.attrs;
        default = {};
        example = {
          flags = "a1f";
          interval = 5;
        };
        description = ''
          Parameters to be written to <filename>/etc/atoprc</filename>
        '';
      };

    };
  };

  config = mkIf (cfg.settings != {}) {
    environment.etc."atoprc".text =
      concatStrings (mapAttrsToList (n: v: "${n} ${toString v}\n") cfg.settings);
  };
}