aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/misc/debug.nix
blob: d27d496b4239f15c9c136988e78202671b9eb5b2 (plain)
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
{ config, pkgs, lib, ... }:

with lib;

{
  options.home = {
    enableDebugInfo = mkEnableOption "" // {
      description = ''
        Some Nix-packages provide debug symbols for
        <command>gdb</command> in the <literal>debug</literal>-output.
        This option ensures that those are automatically fetched from
        the binary cache if available and <command>gdb</command> is
        configured to find those symbols.
      '';
    };
  };

  config = mkIf config.home.enableDebugInfo {
    home.extraOutputsToInstall = [ "debug" ];

    home.sessionVariables = {
      NIX_DEBUG_INFO_DIRS =
        "$NIX_DEBUG_INFO_DIRS\${NIX_DEBUG_INFO_DIRS:+:}${config.home.profileDirectory}/lib/debug";
    };
  };
}