cppcodec, nitrokey-app: fix build failure with cmake 4 (#453359)

This commit is contained in:
Vladimír Čunát
2025-10-27 09:03:37 +00:00
committed by GitHub
2 changed files with 23 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
stdenv,
fetchFromGitHub,
cmake,
fetchpatch,
}:
stdenv.mkDerivation (finalAttrs: {
@@ -16,6 +17,17 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-k4EACtDOSkTXezTeFtVdM1EVJjvGga/IQSrvDzhyaXw=";
};
patches = [
# CMake 2.8 is deprecated and is no longer supported by CMake > 4
# https://github.com/NixOS/nixpkgs/issues/445447
# Luckily, this has been fixed on master.
(fetchpatch {
name = "modernize-cmake.patch";
url = "https://github.com/tplgy/cppcodec/commit/8019b8b580f8573c33c50372baec7039dfe5a8ce.patch";
hash = "sha256-0MCx3nTsey4Qonx+lyexbcxut0qIHOJZbkJ9u23Zuv8=";
})
];
nativeBuildInputs = [ cmake ];
meta = with lib; {

View File

@@ -38,6 +38,17 @@ stdenv.mkDerivation rec {
cppcodec
];
# CMake 3.1 is deprecated and is no longer supported by CMake > 4
# https://github.com/NixOS/nixpkgs/issues/445447
postPatch = ''
substituteInPlace CMakeLists.txt --replace-fail \
"CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR)" \
"cmake_minimum_required(VERSION 3.10 FATAL_ERROR)" \
--replace-fail \
"cmake_policy(SET CMP0043 OLD)" \
"cmake_policy(SET CMP0043 NEW)"
'';
meta = with lib; {
description = "Provides extra functionality for the Nitrokey Pro and Storage";
mainProgram = "nitrokey-app";