at 25.11-pre 1.2 kB view raw
1{ config, lib, ... }: 2{ 3 4 options = { 5 6 environment.enableDebugInfo = lib.mkOption { 7 type = lib.types.bool; 8 default = false; 9 description = '' 10 Some NixOS packages provide debug symbols. However, these are 11 not included in the system closure by default to save disk 12 space. Enabling this option causes the debug symbols to appear 13 in {file}`/run/current-system/sw/lib/debug/.build-id`, 14 where tools such as {command}`gdb` can find them. 15 If you need debug symbols for a package that doesn't 16 provide them by default, you can enable them as follows: 17 18 nixpkgs.config.packageOverrides = pkgs: { 19 hello = pkgs.hello.overrideAttrs (oldAttrs: { 20 separateDebugInfo = true; 21 }); 22 }; 23 ''; 24 }; 25 26 }; 27 28 config = lib.mkIf config.environment.enableDebugInfo { 29 30 # FIXME: currently disabled because /lib is already in 31 # environment.pathsToLink, and we can't have both. 32 #environment.pathsToLink = [ "/lib/debug/.build-id" ]; 33 34 environment.extraOutputsToInstall = [ "debug" ]; 35 36 environment.variables.NIX_DEBUG_INFO_DIRS = [ "/run/current-system/sw/lib/debug" ]; 37 38 }; 39 40}