45 , opencascade-occt_7_6
62 assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
63 "'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
64 assert testing -> !stable
65 -> throw "testing implies stable and cannot be used with stable = false";
68 opencascade-occt = opencascade-occt_7_6;
69 inherit (lib) optional optionals optionalString;
71 stdenv.mkDerivation rec {
73 version = if (stable) then kicadVersion else builtins.substring 0 10 src.rev;
78 # upstream issue 12941 (attempted to upstream, but appreciably unacceptable)
80 # https://gitlab.com/kicad/code/kicad/-/issues/15687
81 ./runtime_stock_data_path.patch
84 # tagged releases don't have "unknown"
85 # kicad testing and nightlies use git describe --dirty
86 # nix removes .git, so its approximated here
87 postPatch = lib.optionalString (!stable || testing) ''
88 substituteInPlace cmake/KiCadVersion.cmake \
89 --replace "unknown" "${builtins.substring 0 10 src.rev}"
91 substituteInPlace cmake/CreateGitVersionHeader.cmake \
92 --replace "0000000000000000000000000000000000000000" "${src.rev}"
95 makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
99 "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
100 # https://gitlab.com/kicad/code/kicad/-/issues/17133
101 "-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_spice'"
103 ++ optional (stdenv.hostPlatform.system == "aarch64-linux")
104 "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;'qa_spice|qa_cli'"
105 ++ optional (stable && !withNgspice) "-DKICAD_SPICE=OFF"
106 ++ optionals (!withScripting) [
107 "-DKICAD_SCRIPTING_WXPYTHON=OFF"
109 ++ optionals (withI18n) [
110 "-DKICAD_BUILD_I18N=ON"
112 ++ optionals (!doInstallCheck) [
113 "-DKICAD_BUILD_QA_TESTS=OFF"
115 ++ optionals (debug) [
116 "-DKICAD_STDLIB_DEBUG=ON"
117 "-DKICAD_USE_VALGRIND=ON"
119 ++ optionals (sanitizeAddress) [
120 "-DKICAD_SANITIZE_ADDRESS=ON"
122 ++ optionals (sanitizeThreads) [
123 "-DKICAD_SANITIZE_THREADS=ON"
126 cmakeBuildType = if debug then "Debug" else "Release";
128 nativeBuildInputs = [
138 # wanted by configuration on linux, doesn't seem to affect performance
139 # no effect on closure size
140 ++ optionals (stdenv.hostPlatform.isLinux) [
177 ++ optional (withScripting) wxPython
178 ++ optional (withNgspice) libngspice
179 ++ optional (debug) valgrind;
181 # some ngspice tests attempt to write to $HOME/.cache/
182 # this could be and was resolved with XDG_CACHE_HOME = "$TMP";
183 # but failing tests still attempt to create $HOME
184 # and the newer CLI tests seem to also use $HOME...
187 # debug builds fail all but the python test
188 doInstallCheck = !(debug);
189 installCheckTarget = "test";
191 nativeInstallCheckInputs = [
192 (python.withPackages(ps: with ps; [
203 description = "Just the built source without the libraries";
205 Just the build products, the libraries are passed via an env var in the wrapper, default.nix
207 homepage = "https://www.kicad.org/";
208 license = lib.licenses.gpl3Plus;
209 platforms = lib.platforms.all;