at 24.11-pre 1.2 kB view raw
1{ config, lib, ... }: 2 3with 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 {file}`/run/current-system/sw/lib/debug/.build-id`, 17 where tools such as {command}`gdb` 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 21 nixpkgs.config.packageOverrides = pkgs: { 22 hello = pkgs.hello.overrideAttrs (oldAttrs: { 23 separateDebugInfo = true; 24 }); 25 }; 26 ''; 27 }; 28 29 }; 30 31 32 config = mkIf config.environment.enableDebugInfo { 33 34 # FIXME: currently disabled because /lib is already in 35 # environment.pathsToLink, and we can't have both. 36 #environment.pathsToLink = [ "/lib/debug/.build-id" ]; 37 38 environment.extraOutputsToInstall = [ "debug" ]; 39 40 environment.variables.NIX_DEBUG_INFO_DIRS = [ "/run/current-system/sw/lib/debug" ]; 41 42 }; 43 44}