From fd52eaec4f3639b774480df9423089c0934964a1 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:13:38 +0200 Subject: [PATCH 01/11] timeshift: use `finalAttrs` pattern --- pkgs/applications/backup/timeshift/unwrapped.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/backup/timeshift/unwrapped.nix b/pkgs/applications/backup/timeshift/unwrapped.nix index 7e3d6395a0e9..985bccde947b 100644 --- a/pkgs/applications/backup/timeshift/unwrapped.nix +++ b/pkgs/applications/backup/timeshift/unwrapped.nix @@ -16,14 +16,14 @@ xapp, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "timeshift"; version = "25.07.7"; src = fetchFromGitHub { owner = "linuxmint"; repo = "timeshift"; - rev = version; + rev = finalAttrs.version; hash = "sha256-X3TwUkOeGzcgFM/4Fyfs8eQuGK2wHe3t13WSpIizX8s="; }; @@ -76,4 +76,4 @@ stdenv.mkDerivation rec { bobby285271 ]; }; -} +}) From 5ba30f6bddfe136a05b55a9f5b09c2d5e5911d89 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:14:05 +0200 Subject: [PATCH 02/11] timeshift: use `tag` --- pkgs/applications/backup/timeshift/unwrapped.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/backup/timeshift/unwrapped.nix b/pkgs/applications/backup/timeshift/unwrapped.nix index 985bccde947b..182f7d1fa30b 100644 --- a/pkgs/applications/backup/timeshift/unwrapped.nix +++ b/pkgs/applications/backup/timeshift/unwrapped.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "linuxmint"; repo = "timeshift"; - rev = finalAttrs.version; + tag = finalAttrs.version; hash = "sha256-X3TwUkOeGzcgFM/4Fyfs8eQuGK2wHe3t13WSpIizX8s="; }; From e8523e5c30d2b0ca76f097782f886ccb8fd94ec0 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:15:00 +0200 Subject: [PATCH 03/11] timeshift: remove `with lib;` from `meta` --- pkgs/applications/backup/timeshift/unwrapped.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/backup/timeshift/unwrapped.nix b/pkgs/applications/backup/timeshift/unwrapped.nix index 182f7d1fa30b..8a2902d8ca9d 100644 --- a/pkgs/applications/backup/timeshift/unwrapped.nix +++ b/pkgs/applications/backup/timeshift/unwrapped.nix @@ -62,16 +62,16 @@ stdenv.mkDerivation (finalAttrs: { 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 ]; From ea9c6a41441e82e671afe771450e9dfbfc21fdd9 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:15:26 +0200 Subject: [PATCH 04/11] timeshift: use `util-linuxMinimal` --- pkgs/applications/backup/timeshift/unwrapped.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/backup/timeshift/unwrapped.nix b/pkgs/applications/backup/timeshift/unwrapped.nix index 8a2902d8ca9d..258b49c22225 100644 --- a/pkgs/applications/backup/timeshift/unwrapped.nix +++ b/pkgs/applications/backup/timeshift/unwrapped.nix @@ -11,7 +11,7 @@ gtk3, json-glib, libgee, - util-linux, + util-linuxMinimal, vte, xapp, }: @@ -30,7 +30,7 @@ stdenv.mkDerivation (finalAttrs: { 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 \ From fa179509e829a6668836a478a95ee24bd9c50f9e Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:17:00 +0200 Subject: [PATCH 05/11] kicad: remove unused stuff --- pkgs/applications/science/electronics/kicad/base.nix | 3 +-- pkgs/applications/science/electronics/kicad/default.nix | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index bb9b954281e5..dd416109f6a5 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -51,7 +51,6 @@ stable, testing, - baseName, kicadSrc, kicadVersion, withNgspice, @@ -69,7 +68,7 @@ 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) optional optionals; in stdenv.mkDerivation rec { pname = "kicad-base"; diff --git a/pkgs/applications/science/electronics/kicad/default.nix b/pkgs/applications/science/electronics/kicad/default.nix index 89e3d6350203..163902ab15b2 100644 --- a/pkgs/applications/science/electronics/kicad/default.nix +++ b/pkgs/applications/science/electronics/kicad/default.nix @@ -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; From c9b01a45b36ef35f61b74672083577fe11f85024 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:17:43 +0200 Subject: [PATCH 06/11] kicad: fix use of `optional`, remove obsolete parenthesys --- .../science/electronics/kicad/base.nix | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index dd416109f6a5..2b98f1840bab 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -68,11 +68,11 @@ assert testing -> !stable -> throw "testing implies stable and cannot be used wi let opencascade-occt = opencascade-occt_7_6; - inherit (lib) optional optionals; + inherit (lib) optionals optionalString; in stdenv.mkDerivation rec { 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 src.rev; src = kicadSrc; @@ -94,7 +94,7 @@ stdenv.mkDerivation rec { --replace "0000000000000000000000000000000000000000" "${src.rev}" ''; - preConfigure = optional (debug) '' + preConfigure = optionalString debug '' export CFLAGS="''${CFLAGS:-} -Og -ggdb" export CXXFLAGS="''${CXXFLAGS:-} -Og -ggdb" ''; @@ -106,27 +106,27 @@ stdenv.mkDerivation rec { "-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_spice'" "-DKICAD_USE_CMAKE_FINDPROTOBUF=OFF" ] - ++ optional ( - stdenv.hostPlatform.system == "aarch64-linux" - ) "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;'qa_spice|qa_cli'" - ++ optional (stable && !withNgspice) "-DKICAD_SPICE=OFF" + ++ optionals (stdenv.hostPlatform.system == "aarch64-linux") [ + "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;'qa_spice|qa_cli'" + ] + ++ optionals (stable && !withNgspice) [ "-DKICAD_SPICE=OFF" ] ++ optionals (!withScripting) [ "-DKICAD_SCRIPTING_WXPYTHON=OFF" ] - ++ optionals (withI18n) [ + ++ optionals withI18n [ "-DKICAD_BUILD_I18N=ON" ] ++ optionals (!doInstallCheck) [ "-DKICAD_BUILD_QA_TESTS=OFF" ] - ++ optionals (debug) [ + ++ optionals debug [ "-DKICAD_STDLIB_DEBUG=ON" "-DKICAD_USE_VALGRIND=ON" ] - ++ optionals (sanitizeAddress) [ + ++ optionals sanitizeAddress [ "-DKICAD_SANITIZE_ADDRESS=ON" ] - ++ optionals (sanitizeThreads) [ + ++ optionals sanitizeThreads [ "-DKICAD_SANITIZE_THREADS=ON" ]; @@ -185,9 +185,9 @@ 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; + ++ optionals withScripting [ wxPython ] + ++ optionals withNgspice [ libngspice ] + ++ optionals debug [ valgrind ]; # some ngspice tests attempt to write to $HOME/.cache/ # this could be and was resolved with XDG_CACHE_HOME = "$TMP"; @@ -196,7 +196,7 @@ stdenv.mkDerivation rec { HOME = "$TMP"; # debug builds fail all but the python test - doInstallCheck = !(debug); + doInstallCheck = !debug; installCheckTarget = "test"; nativeInstallCheckInputs = [ From af6ba758f37d8822ee04033f7e8fbf99bf530bc3 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:20:24 +0200 Subject: [PATCH 07/11] kicad: use `--replace-fail` --- pkgs/applications/science/electronics/kicad/base.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index 2b98f1840bab..1e1c3ca3bb86 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -88,10 +88,10 @@ 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 src.rev}" substituteInPlace cmake/CreateGitVersionHeader.cmake \ - --replace "0000000000000000000000000000000000000000" "${src.rev}" + --replace-fail "0000000000000000000000000000000000000000" "${src.rev}" ''; preConfigure = optionalString debug '' From fb17c874ab7e0ee90b2a2274be42e2cd5034ce4f Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:21:28 +0200 Subject: [PATCH 08/11] kicad: use `cmakeFeature`, `cmakeBool` --- .../science/electronics/kicad/base.nix | 47 ++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index 1e1c3ca3bb86..2cd9703a03ea 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -68,7 +68,12 @@ assert testing -> !stable -> throw "testing implies stable and cannot be used wi let opencascade-occt = opencascade-occt_7_6; - inherit (lib) optionals optionalString; + inherit (lib) + cmakeBool + cmakeFeature + optionals + optionalString + ; in stdenv.mkDerivation rec { pname = "kicad-base"; @@ -100,34 +105,22 @@ stdenv.mkDerivation rec { ''; 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" (!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))) ] - ++ optionals (stdenv.hostPlatform.system == "aarch64-linux") [ - "-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;'qa_spice|qa_cli'" - ] - ++ optionals (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"; From 8b7325980b878c3ec9bf919d701564cb2f1f2831 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:30:52 +0200 Subject: [PATCH 09/11] kicad: use `finalAttrs` pattern --- pkgs/applications/science/electronics/kicad/base.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index 2cd9703a03ea..5346b6fe133c 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -75,9 +75,9 @@ let 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; @@ -93,10 +93,10 @@ stdenv.mkDerivation rec { # nix removes .git, so its approximated here postPatch = lib.optionalString (!stable || testing) '' substituteInPlace cmake/KiCadVersion.cmake \ - --replace-fail "unknown" "${builtins.substring 0 10 src.rev}" + --replace-fail "unknown" "${builtins.substring 0 10 finalAttrs.src.rev}" substituteInPlace cmake/CreateGitVersionHeader.cmake \ - --replace-fail "0000000000000000000000000000000000000000" "${src.rev}" + --replace-fail "0000000000000000000000000000000000000000" "${finalAttrs.src.rev}" ''; preConfigure = optionalString debug '' @@ -112,7 +112,7 @@ stdenv.mkDerivation rec { (cmakeBool "KICAD_USE_CMAKE_FINDPROTOBUF" false) (cmakeBool "KICAD_SCRIPTING_WXPYTHON" withScripting) (cmakeBool "KICAD_BUILD_I18N" withI18n) - (cmakeBool "KICAD_BUILD_QA_TESTS" (!doInstallCheck)) + (cmakeBool "KICAD_BUILD_QA_TESTS" (!finalAttrs.doInstallCheck)) (cmakeBool "KICAD_STDLIB_DEBUG" debug) (cmakeBool "KICAD_USE_VALGRIND" debug) (cmakeBool "KICAD_SANITIZE_ADDRESS" sanitizeAddress) @@ -215,4 +215,4 @@ stdenv.mkDerivation rec { platforms = lib.platforms.all; broken = stdenv.hostPlatform.isDarwin; }; -} +}) From 8eaf19776ca4ec34a5bd5d2a1a44c4a3a1679761 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:34:10 +0200 Subject: [PATCH 10/11] kicad: use `writableTmpDirAsHomeHook` --- pkgs/applications/science/electronics/kicad/base.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index 5346b6fe133c..f7e5b6554bd7 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -26,6 +26,7 @@ libgcrypt, libgpg-error, ninja, + writableTmpDirAsHomeHook, util-linux, libselinux, @@ -182,12 +183,6 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withNgspice [ libngspice ] ++ optionals 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"; - # debug builds fail all but the python test doInstallCheck = !debug; installCheckTarget = "test"; @@ -201,6 +196,7 @@ stdenv.mkDerivation (finalAttrs: { pytest-image-diff ] )) + writableTmpDirAsHomeHook ]; dontStrip = debug; From 8cd6c6f1f6ce8f86ca18988340f2069948ba487e Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 3 Sep 2025 15:35:27 +0200 Subject: [PATCH 11/11] kicad: use `util-linuxMinimal` --- pkgs/applications/science/electronics/kicad/base.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index f7e5b6554bd7..a52799550842 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -28,7 +28,7 @@ ninja, writableTmpDirAsHomeHook, - util-linux, + util-linuxMinimal, libselinux, libsepol, libthai, @@ -140,7 +140,7 @@ stdenv.mkDerivation (finalAttrs: { # 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