{kicad, timeshift}: use util-linuxMinimal, refactor, cleanup (#439857)

This commit is contained in:
Gaétan Lepage
2025-09-10 11:53:01 +02:00
committed by GitHub
3 changed files with 44 additions and 56 deletions
@@ -11,26 +11,26 @@
gtk3,
json-glib,
libgee,
util-linux,
util-linuxMinimal,
vte,
xapp,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "timeshift";
version = "25.07.7";
src = fetchFromGitHub {
owner = "linuxmint";
repo = "timeshift";
rev = version;
tag = finalAttrs.version;
hash = "sha256-X3TwUkOeGzcgFM/4Fyfs8eQuGK2wHe3t13WSpIizX8s=";
};
postPatch = ''
for FILE in src/Core/Main.vala src/Utility/Device.vala; do
substituteInPlace "$FILE" \
--replace-fail "/sbin/blkid" "${lib.getExe' util-linux "blkid"}"
--replace-fail "/sbin/blkid" "${lib.getExe' util-linuxMinimal "blkid"}"
done
substituteInPlace ./src/Utility/IconManager.vala \
@@ -62,18 +62,18 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
};
meta = with lib; {
meta = {
description = "System restore tool for Linux";
longDescription = ''
TimeShift creates filesystem snapshots using rsync+hardlinks or BTRFS snapshots.
Snapshots can be restored using TimeShift installed on the system or from Live CD or USB.
'';
homepage = "https://github.com/linuxmint/timeshift";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
ShamrockLee
bobby285271
];
};
}
})
@@ -26,8 +26,9 @@
libgcrypt,
libgpg-error,
ninja,
writableTmpDirAsHomeHook,
util-linux,
util-linuxMinimal,
libselinux,
libsepol,
libthai,
@@ -51,7 +52,6 @@
stable,
testing,
baseName,
kicadSrc,
kicadVersion,
withNgspice,
@@ -69,11 +69,16 @@ assert testing -> !stable -> throw "testing implies stable and cannot be used wi
let
opencascade-occt = opencascade-occt_7_6;
inherit (lib) optional optionals optionalString;
inherit (lib)
cmakeBool
cmakeFeature
optionals
optionalString
;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "kicad-base";
version = if (stable) then kicadVersion else builtins.substring 0 10 src.rev;
version = if stable then kicadVersion else builtins.substring 0 10 finalAttrs.src.rev;
src = kicadSrc;
@@ -89,46 +94,34 @@ stdenv.mkDerivation rec {
# nix removes .git, so its approximated here
postPatch = lib.optionalString (!stable || testing) ''
substituteInPlace cmake/KiCadVersion.cmake \
--replace "unknown" "${builtins.substring 0 10 src.rev}"
--replace-fail "unknown" "${builtins.substring 0 10 finalAttrs.src.rev}"
substituteInPlace cmake/CreateGitVersionHeader.cmake \
--replace "0000000000000000000000000000000000000000" "${src.rev}"
--replace-fail "0000000000000000000000000000000000000000" "${finalAttrs.src.rev}"
'';
preConfigure = optional (debug) ''
preConfigure = optionalString debug ''
export CFLAGS="''${CFLAGS:-} -Og -ggdb"
export CXXFLAGS="''${CXXFLAGS:-} -Og -ggdb"
'';
cmakeFlags = [
"-DKICAD_USE_EGL=ON"
"-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
(cmakeBool "KICAD_USE_EGL" true)
(cmakeFeature "OCC_INCLUDE_DIR" "${opencascade-occt}/include/opencascade")
# https://gitlab.com/kicad/code/kicad/-/issues/17133
"-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_spice'"
"-DKICAD_USE_CMAKE_FINDPROTOBUF=OFF"
(cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;qa_spice")
(cmakeBool "KICAD_USE_CMAKE_FINDPROTOBUF" false)
(cmakeBool "KICAD_SCRIPTING_WXPYTHON" withScripting)
(cmakeBool "KICAD_BUILD_I18N" withI18n)
(cmakeBool "KICAD_BUILD_QA_TESTS" (!finalAttrs.doInstallCheck))
(cmakeBool "KICAD_STDLIB_DEBUG" debug)
(cmakeBool "KICAD_USE_VALGRIND" debug)
(cmakeBool "KICAD_SANITIZE_ADDRESS" sanitizeAddress)
(cmakeBool "KICAD_SANITIZE_THREADS" sanitizeThreads)
(cmakeBool "KICAD_SPICE" (!(stable && !withNgspice)))
]
++ optional (
stdenv.hostPlatform.system == "aarch64-linux"
) "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;'qa_spice|qa_cli'"
++ optional (stable && !withNgspice) "-DKICAD_SPICE=OFF"
++ optionals (!withScripting) [
"-DKICAD_SCRIPTING_WXPYTHON=OFF"
]
++ optionals (withI18n) [
"-DKICAD_BUILD_I18N=ON"
]
++ optionals (!doInstallCheck) [
"-DKICAD_BUILD_QA_TESTS=OFF"
]
++ optionals (debug) [
"-DKICAD_STDLIB_DEBUG=ON"
"-DKICAD_USE_VALGRIND=ON"
]
++ optionals (sanitizeAddress) [
"-DKICAD_SANITIZE_ADDRESS=ON"
]
++ optionals (sanitizeThreads) [
"-DKICAD_SANITIZE_THREADS=ON"
++ optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
(cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;'qa_spice|qa_cli'")
];
cmakeBuildType = if debug then "Debug" else "Release";
@@ -147,7 +140,7 @@ stdenv.mkDerivation rec {
# wanted by configuration on linux, doesn't seem to affect performance
# no effect on closure size
++ optionals (stdenv.hostPlatform.isLinux) [
util-linux
util-linuxMinimal
libselinux
libsepol
libthai
@@ -186,18 +179,12 @@ stdenv.mkDerivation rec {
# This would otherwise cause a linking requirement for mbedtls.
(nng.override { mbedtlsSupport = false; })
]
++ optional (withScripting) wxPython
++ optional (withNgspice) libngspice
++ optional (debug) valgrind;
# some ngspice tests attempt to write to $HOME/.cache/
# this could be and was resolved with XDG_CACHE_HOME = "$TMP";
# but failing tests still attempt to create $HOME
# and the newer CLI tests seem to also use $HOME...
HOME = "$TMP";
++ optionals withScripting [ wxPython ]
++ optionals withNgspice [ libngspice ]
++ optionals debug [ valgrind ];
# debug builds fail all but the python test
doInstallCheck = !(debug);
doInstallCheck = !debug;
installCheckTarget = "test";
nativeInstallCheckInputs = [
@@ -209,6 +196,7 @@ stdenv.mkDerivation rec {
pytest-image-diff
]
))
writableTmpDirAsHomeHook
];
dontStrip = debug;
@@ -223,4 +211,4 @@ stdenv.mkDerivation rec {
platforms = lib.platforms.all;
broken = stdenv.hostPlatform.isDarwin;
};
}
})
@@ -178,7 +178,7 @@ stdenv.mkDerivation rec {
passthru.libraries = callPackages ./libraries.nix { inherit libSrc; };
passthru.callPackage = newScope { inherit addonPath python3; };
base = callPackage ./base.nix {
inherit stable testing baseName;
inherit stable testing;
inherit kicadSrc kicadVersion;
inherit wxGTK python wxPython;
inherit withNgspice withScripting withI18n;