git.iko.soy/typeable/nixpkgs
on master help sign in
Add option environment.enableDebugInfo

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

commitd9d5c98c56809d2941404751b2304beab4e00c3e authorEelco Dolstra <eelco.dolstra@logicblox.com> dateFri 30 Oct 2015, 15:16 (11 years ago) parentc204036
4 files changed+52−4
nixos/modules/config/debug-info.nix+46 nixos/modules/config/system-path.nix+1−2 nixos/modules/module-list.nix+3−2 pkgs/tools/package-management/nix/default.nix+2
nixos/modules/config/debug-info.nixnew file+46
@@ -0,0 +1,46 @@
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+}
nixos/modules/config/system-path.nix+1−2
@@ -103,8 +103,7 @@ in
103103 [ "/bin"
104104 "/etc/xdg"
105105 "/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
108107 "/sbin"
109108 "/share/applications"
110109 "/share/desktop-directories"
nixos/modules/module-list.nix+3−2
@@ -1,7 +1,8 @@
11[
2+ ./config/debug-info.nix
23 ./config/fonts/corefonts.nix
3− ./config/fonts/fontconfig.nix
44 ./config/fonts/fontconfig-ultimate.nix
5+ ./config/fonts/fontconfig.nix
56 ./config/fonts/fontdir.nix
67 ./config/fonts/fonts.nix
78 ./config/fonts/ghostscript.nix
@@ -22,9 +23,9 @@
2223 ./config/system-environment.nix
2324 ./config/system-path.nix
2425 ./config/timezone.nix
25− ./config/vpnc.nix
2626 ./config/unix-odbc-drivers.nix
2727 ./config/users-groups.nix
28+ ./config/vpnc.nix
2829 ./config/zram.nix
2930 ./hardware/all-firmware.nix
3031 ./hardware/cpu/amd-microcode.nix
pkgs/tools/package-management/nix/default.nix+2
@@ -43,6 +43,8 @@ let
4343
4444 doInstallCheck = false;
4545
46+ separateDebugInfo = stdenv.isLinux;
47+
4648 crossAttrs = {
4749 postUnpack =
4850 '' export CPATH="${bzip2.crossDrv}/include"