lol

Add option environment.enableDebugInfo

This makes the debug outputs of packages that have them available to
programs like gdb.

+52 -4
+46
nixos/modules/config/debug-info.nix
··· 1 + { config, lib, ... }: 2 + 3 + with lib; 4 + 5 + { 6 + 7 + options = { 8 + 9 + environment.enableDebugInfo = mkOption { 10 + type = types.bool; 11 + default = false; 12 + description = '' 13 + Some NixOS packages provide debug symbols. However, these are 14 + not included in the system closure by default to save disk 15 + space. Enabling this option causes the debug symbols to appear 16 + in <filename>/run/current-system/sw/lib/debug/.build-id</filename>, 17 + where tools such as <command>gdb</command> can find them. 18 + If you need debug symbols for a package that doesn't 19 + provide them by default, you can enable them as follows: 20 + <!-- FIXME: ugly, see #10721 --> 21 + <programlisting> 22 + nixpkgs.config.packageOverrides = pkgs: { 23 + hello = overrideDerivation pkgs.hello (attrs: { 24 + outputs = attrs.outputs or ["out"] ++ ["debug"]; 25 + buildInputs = attrs.buildInputs ++ [&lt;nixpkgs/pkgs/build-support/setup-hooks/separate-debug-info.sh>]; 26 + }); 27 + }; 28 + </programlisting> 29 + ''; 30 + }; 31 + 32 + }; 33 + 34 + 35 + config = { 36 + 37 + # FIXME: currently disabled because /lib is already in 38 + # environment.pathsToLink, and we can't have both. 39 + #environment.pathsToLink = [ "/lib/debug/.build-id" ]; 40 + 41 + environment.outputsToLink = 42 + optional config.environment.enableDebugInfo "debug"; 43 + 44 + }; 45 + 46 + }
+1 -2
nixos/modules/config/system-path.nix
··· 103 103 [ "/bin" 104 104 "/etc/xdg" 105 105 "/info" 106 - "/lib" # FIXME: remove 107 - #"/lib/debug/.build-id" # enables GDB to find separated debug info 106 + "/lib" # FIXME: remove and update debug-info.nix 108 107 "/sbin" 109 108 "/share/applications" 110 109 "/share/desktop-directories"
+3 -2
nixos/modules/module-list.nix
··· 1 1 [ 2 + ./config/debug-info.nix 2 3 ./config/fonts/corefonts.nix 4 + ./config/fonts/fontconfig-ultimate.nix 3 5 ./config/fonts/fontconfig.nix 4 - ./config/fonts/fontconfig-ultimate.nix 5 6 ./config/fonts/fontdir.nix 6 7 ./config/fonts/fonts.nix 7 8 ./config/fonts/ghostscript.nix ··· 22 23 ./config/system-environment.nix 23 24 ./config/system-path.nix 24 25 ./config/timezone.nix 25 - ./config/vpnc.nix 26 26 ./config/unix-odbc-drivers.nix 27 27 ./config/users-groups.nix 28 + ./config/vpnc.nix 28 29 ./config/zram.nix 29 30 ./hardware/all-firmware.nix 30 31 ./hardware/cpu/amd-microcode.nix
+2
pkgs/tools/package-management/nix/default.nix
··· 43 43 44 44 doInstallCheck = false; 45 45 46 + separateDebugInfo = stdenv.isLinux; 47 + 46 48 crossAttrs = { 47 49 postUnpack = 48 50 '' export CPATH="${bzip2.crossDrv}/include"