diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index 931202a1f89f..9848eb58399d 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -50,12 +50,18 @@ , withNgspice , withScripting , debug +, sanitizeAddress +, sanitizeThreads , withI18n }: assert lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64"; assert lib.asserts.assertMsg (!(withOCC && withOCE)) "Only one of OCC and OCE may be enabled"; +assert lib.assertMsg (!(stable && (sanitizeAddress || sanitizeThreads))) + "Only kicad-unstable(-small) supports address/thread sanitation"; +assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads)) + "'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one."; let inherit (lib) optional optionals; in @@ -98,6 +104,12 @@ stdenv.mkDerivation rec { "-DCMAKE_BUILD_TYPE=Debug" "-DKICAD_STDLIB_DEBUG=ON" "-DKICAD_USE_VALGRIND=ON" + ] + ++ optionals (sanitizeAddress) [ + "-DKICAD_SANITIZE_ADDRESS=ON" + ] + ++ optionals (sanitizeThreads) [ + "-DKICAD_SANITIZE_THREADS=ON" ]; nativeBuildInputs = [ diff --git a/pkgs/applications/science/electronics/kicad/default.nix b/pkgs/applications/science/electronics/kicad/default.nix index e8cb749268fd..79a044a800c5 100644 --- a/pkgs/applications/science/electronics/kicad/default.nix +++ b/pkgs/applications/science/electronics/kicad/default.nix @@ -25,6 +25,8 @@ , withScripting ? true , python3 , debug ? false +, sanitizeAddress ? false +, sanitizeThreads ? false , with3d ? true , withI18n ? true , srcs ? { } @@ -162,7 +164,8 @@ stdenv.mkDerivation rec { inherit kicadSrc kicadVersion; inherit (passthru) i18n; inherit wxGTK python wxPython; - inherit debug withI18n withOCC withOCE withNgspice withScripting; + inherit withI18n withOCC withOCE withNgspice withScripting; + inherit debug sanitizeAddress sanitizeThreads; }; inherit pname;