main
 1{
 2  den.aspects.desktop.game.mangohud = {
 3    hjem = {
 4      pkgs,
 5      lib,
 6      ...
 7    }: let
 8      renderOption = option:
 9        rec {
10          int = toString option;
11          float = int;
12          path = int;
13          bool = "0"; # "on/off" opts are disabled with `=0`
14          string = option;
15          list = lib.concatStringsSep "," (lib.lists.forEach option toString);
16        }.${
17          builtins.typeOf option
18        };
19
20      renderLine = k: v: (
21        if lib.isBool v && v
22        then k
23        else "${k}=${renderOption v}"
24      );
25      renderSettings = attrs: lib.strings.concatStringsSep "\n" (lib.attrsets.mapAttrsToList renderLine attrs) + "\n";
26    in {
27      packages = [pkgs.mangohud];
28
29      xdg.config.files."MangoHud/MangoHud.conf" = {
30        generator = renderSettings;
31        value = {
32          fps = true;
33          frametime = true;
34
35          # Hardware stats
36          cpu_stats = true;
37          cpu_temp = true;
38          cpu_power = true;
39          cpu_mhz = true;
40          gpu_stats = true;
41          gpu_temp = true;
42          gpu_power = true;
43          gpu_core_clock = true;
44          gpu_mem_clock = true;
45          ram = true;
46          vram = true;
47
48          # Keybinds
49          toggle_hud = "Shift_R+F12";
50        };
51      };
52    };
53  };
54}