Skip to content

Commit 70d8d89

Browse files
authored
Merge pull request #1041 from pq-code-package/nix25.05
Update to nixpkgs 25.05
2 parents 97bfbfa + 80ba80e commit 70d8d89

File tree

9 files changed

+127
-110
lines changed

9 files changed

+127
-110
lines changed

.github/workflows/all.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
permissions:
4141
contents: 'read'
4242
id-token: 'write'
43-
needs: [ base ]
43+
needs: [ base, nix ]
4444
uses: ./.github/workflows/cbmc.yml
4545
secrets: inherit
4646
oqs_integration:
@@ -76,14 +76,14 @@ jobs:
7676
permissions:
7777
contents: 'read'
7878
id-token: 'write'
79-
needs: [ base ]
79+
needs: [ base, nix ]
8080
uses: ./.github/workflows/ct-tests.yml
8181
secrets: inherit
8282
slothy:
8383
name: SLOTHY
8484
permissions:
8585
contents: 'read'
8686
id-token: 'write'
87-
needs: [ base ]
87+
needs: [ base, nix ]
8888
uses: ./.github/workflows/slothy.yml
8989
secrets: inherit

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ jobs:
252252
c23: False
253253
examples: False
254254
opt: no_opt
255+
- name: zig-0.14
256+
shell: ci_zig0_14
257+
darwin: True
258+
c17: True
259+
c23: True
260+
examples: False
261+
opt: no_opt
255262
runs-on: ${{ matrix.target.runner }}
256263
steps:
257264
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
inputs = {
77
nixpkgs-2405.url = "github:NixOS/nixpkgs/nixos-24.05";
8-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
8+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
99
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
1010

1111
flake-parts = {
@@ -23,9 +23,10 @@
2323
pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${system};
2424
pkgs-2405 = inputs.nixpkgs-2405.legacyPackages.${system};
2525
util = pkgs.callPackage ./nix/util.nix {
26+
# Keep those around in case we want to switch to unstable versions
2627
cbmc = pkgs.cbmc;
27-
bitwuzla = pkgs-unstable.bitwuzla;
28-
z3 = pkgs-unstable.z3_4_14;
28+
bitwuzla = pkgs.bitwuzla;
29+
z3 = pkgs.z3;
2930
};
3031
zigWrapCC = zig: pkgs.symlinkJoin {
3132
name = "zig-wrappers";
@@ -48,8 +49,9 @@
4849
(_:_: {
4950
gcc48 = pkgs-2405.gcc48;
5051
gcc49 = pkgs-2405.gcc49;
51-
qemu = pkgs-unstable.qemu; # 9.2.2
52-
clang_20 = pkgs-unstable.clang_20;
52+
gcc7 = pkgs-2405.gcc7;
53+
zig_0_10 = pkgs-2405.zig_0_10;
54+
zig_0_11 = pkgs-2405.zig_0_11;
5355
})
5456
];
5557
};
@@ -109,6 +111,7 @@
109111
devShells.ci_zig0_11 = util.mkShellWithCC' (zigWrapCC pkgs.zig_0_11);
110112
devShells.ci_zig0_12 = util.mkShellWithCC' (zigWrapCC pkgs.zig_0_12);
111113
devShells.ci_zig0_13 = util.mkShellWithCC' (zigWrapCC pkgs.zig_0_13);
114+
devShells.ci_zig0_14 = util.mkShellWithCC' (zigWrapCC pkgs.zig);
112115

113116
devShells.ci_gcc48 = util.mkShellWithCC' pkgs.gcc48;
114117
devShells.ci_gcc49 = util.mkShellWithCC' pkgs.gcc49;
@@ -142,8 +145,8 @@
142145
util = pkgs.callPackage ./nix/util.nix {
143146
inherit pkgs;
144147
cbmc = pkgs.cbmc;
145-
bitwuzla = pkgs-unstable.bitwuzla;
146-
z3 = pkgs-unstable.z3_4_14;
148+
bitwuzla = pkgs.bitwuzla;
149+
z3 = pkgs.z3;
147150
};
148151
in
149152
util.mkShell {
Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
2-
diff --git a/src/solvers/CMakeLists.txt b/src/solvers/CMakeLists.txt
3-
index 003a0d957b..79751ef8b2 100644
4-
--- a/src/solvers/CMakeLists.txt
5-
+++ b/src/solvers/CMakeLists.txt
6-
@@ -120,16 +120,6 @@ foreach(SOLVER ${sat_impl})
7-
elseif("${SOLVER}" STREQUAL "cadical")
8-
message(STATUS "Building solvers with cadical")
1+
# SPDX-License-Identifier: MIT
2+
From 7b49a436bd5cc903b86b01f1a0f046ab8ec99fdb Mon Sep 17 00:00:00 2001
3+
From: wxt <3264117476@qq.com>
4+
Date: Mon, 11 Nov 2024 11:07:37 +0800
5+
Subject: [PATCH] Do not download sources in cmake
96

10-
- download_project(PROJ cadical
11-
- URL https://github.com/arminbiere/cadical/archive/rel-2.0.0.tar.gz
12-
- PATCH_COMMAND patch -p1 -i ${CBMC_SOURCE_DIR}/scripts/cadical-2.0.0-patch
13-
- COMMAND cmake -E copy ${CBMC_SOURCE_DIR}/scripts/cadical_CMakeLists.txt CMakeLists.txt
14-
- COMMAND ./configure
15-
- URL_MD5 9fc2a66196b86adceb822a583318cc35
16-
- )
17-
-
18-
- add_subdirectory(${cadical_SOURCE_DIR} ${cadical_BINARY_DIR})
19-
-
20-
target_compile_definitions(solvers PUBLIC
21-
SATCHECK_CADICAL HAVE_CADICAL
22-
)
23-
@@ -137,6 +127,7 @@ foreach(SOLVER ${sat_impl})
24-
target_include_directories(solvers
25-
PUBLIC
26-
${cadical_SOURCE_DIR}/src
27-
+ ${cadical_INCLUDE_DIR}
28-
)
7+
---
8+
CMakeLists.txt | 3 +--
9+
1 file changed, 1 insertion(+), 2 deletions(-)
10+
11+
diff --git a/CMakeLists.txt b/CMakeLists.txt
12+
index 2c1289a..8128362 100644
13+
--- a/CMakeLists.txt
14+
+++ b/CMakeLists.txt
15+
@@ -116,8 +116,7 @@ if(DEFINED CMAKE_USE_CUDD)
16+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadProject.cmake")
17+
message(STATUS "Downloading Cudd-3.0.0")
18+
download_project(PROJ cudd
19+
- URL https://sourceforge.net/projects/cudd-mirror/files/cudd-3.0.0.tar.gz/download
20+
- URL_MD5 4fdafe4924b81648b908881c81fe6c30
21+
+ SOURCE_DIR @cudd@
22+
)
23+
24+
if(NOT EXISTS ${cudd_SOURCE_DIR}/Makefile)
25+
--
26+
2.47.0
2927

30-
target_link_libraries(solvers cadical)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SPDX-License-Identifier: MIT
2+
From c6b6438d3c87ce000b4e80b2eda2389e9473d24c Mon Sep 17 00:00:00 2001
3+
From: wxt <3264117476@qq.com>
4+
Date: Mon, 11 Nov 2024 11:35:03 +0800
5+
Subject: [PATCH] Do not download sources in cmake
6+
7+
---
8+
src/solvers/CMakeLists.txt | 9 +++------
9+
1 file changed, 3 insertions(+), 6 deletions(-)
10+
11+
diff --git a/src/solvers/CMakeLists.txt b/src/solvers/CMakeLists.txt
12+
index ab8d111..d7165e2 100644
13+
--- a/src/solvers/CMakeLists.txt
14+
+++ b/src/solvers/CMakeLists.txt
15+
@@ -102,10 +102,9 @@ foreach(SOLVER ${sat_impl})
16+
message(STATUS "Building solvers with glucose")
17+
18+
download_project(PROJ glucose
19+
- URL https://github.com/BrunoDutertre/glucose-syrup/archive/0bb2afd3b9baace6981cbb8b4a1c7683c44968b7.tar.gz
20+
+ SOURCE_DIR @srcglucose@
21+
PATCH_COMMAND patch -p1 -i ${CBMC_SOURCE_DIR}/scripts/glucose-syrup-patch
22+
COMMAND cmake -E copy ${CBMC_SOURCE_DIR}/scripts/glucose_CMakeLists.txt CMakeLists.txt
23+
- URL_MD5 7c539c62c248b74210aef7414787323a
24+
)
25+
26+
add_subdirectory(${glucose_SOURCE_DIR} ${glucose_BINARY_DIR})
27+
@@ -121,11 +120,10 @@ foreach(SOLVER ${sat_impl})
28+
message(STATUS "Building solvers with cadical")
29+
30+
download_project(PROJ cadical
31+
- URL https://github.com/arminbiere/cadical/archive/rel-2.0.0.tar.gz
32+
+ SOURCE_DIR @srccadical@
33+
PATCH_COMMAND patch -p1 -i ${CBMC_SOURCE_DIR}/scripts/cadical-2.0.0-patch
34+
COMMAND cmake -E copy ${CBMC_SOURCE_DIR}/scripts/cadical_CMakeLists.txt CMakeLists.txt
35+
COMMAND ./configure
36+
- URL_MD5 9fc2a66196b86adceb822a583318cc35
37+
)
38+
39+
add_subdirectory(${cadical_SOURCE_DIR} ${cadical_BINARY_DIR})
40+
@@ -144,10 +142,9 @@ foreach(SOLVER ${sat_impl})
41+
message(STATUS "Building with IPASIR solver linking against: CaDiCaL")
42+
43+
download_project(PROJ cadical
44+
- URL https://github.com/arminbiere/cadical/archive/rel-2.0.0.tar.gz
45+
+ SOURCE_DIR @srccadical@
46+
PATCH_COMMAND patch -p1 -i ${CBMC_SOURCE_DIR}/scripts/cadical-2.0.0-patch
47+
COMMAND ./configure
48+
- URL_MD5 9fc2a66196b86adceb822a583318cc35
49+
)
50+
51+
message(STATUS "Building CaDiCaL")
52+
--
53+
2.47.0
54+

nix/cbmc/default.nix

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
, ninja
88
, cadical
99
, z3
10+
, cudd
11+
, replaceVars
1012
}:
1113

1214
buildEnv {
@@ -18,17 +20,24 @@ buildEnv {
1820
src = fetchFromGitHub {
1921
owner = "diffblue";
2022
repo = "cbmc";
21-
rev = "3c915ebe35448a20555c1ef55d51540b52c5c34a";
2223
hash = "sha256-ot0vVBgiSVru/RE7KeyTsXzDfs0CSa5vaFsON+PCZZo=";
24+
tag = "cbmc-6.6.0";
2325
};
26+
# TODO: Remove those once upstream has removed the third patch
27+
patches = [
28+
(replaceVars ./0001-Do-not-download-sources-in-cmake.patch {
29+
cudd = cudd.src;
30+
})
31+
./0002-Do-not-download-sources-in-cmake.patch
32+
];
2433
});
2534
litani = callPackage ./litani.nix { }; # 1.29.0
2635
cbmc-viewer = callPackage ./cbmc-viewer.nix { }; # 3.11
2736

2837
inherit
29-
cadical#1.9.5
38+
cadical#2.1.3
3039
bitwuzla# 0.7.0
31-
z3# 4.14.1
32-
ninja; # 1.11.1
40+
z3# 4.15.0
41+
ninja; # 1.12.1
3342
};
3443
}

nix/slothy/default.nix

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,10 @@
1515

1616

1717
let
18-
# TODO: switch to protobuf from nixpkgs
19-
# ortools 9.12 requires protobuf >= 5.29.3 - currently nixpkgs 24.11 has
20-
# protobuf 5.28.3
21-
protobuf_6_30_1 = python312Packages.buildPythonPackage rec {
22-
pname = "protobuf";
23-
version = "5.29.3";
24-
25-
propagatedBuildInputs = [
26-
python312Packages.setuptools
27-
];
28-
29-
build-system = with python312Packages; [
30-
setuptools
31-
];
32-
33-
dontConfigure = true;
34-
nativeBuildInputs =
35-
[
36-
cmake
37-
pkg-config
38-
];
39-
40-
src = fetchPypi {
41-
inherit pname version;
42-
hash = "sha256-XaD0HtrxF73jFkBLrRpIbLTt7fjkpUiRKW9kjo4HZiA=";
43-
};
44-
};
45-
4618

19+
# I have experimented with the ortools (9.12) that is packaged in nixpkgs.
20+
# However, it results in _much_ poorer SLOTHY performance and, we hence,
21+
# instead stick to the pre-built ones from pypi.
4722
ortools912 = python312Packages.buildPythonPackage rec {
4823
pname = "ortools";
4924
version = "9.12.4544";
@@ -78,44 +53,15 @@ let
7853
propagatedBuildInputs = with python312Packages; [
7954
numpy
8055
pandas
81-
protobuf_6_30_1
56+
protobuf
8257
];
8358

8459
};
8560

86-
# TODO: switch to unicorn from nixpkgs
87-
# nixpkgs 24.11 currently has 2.1.1 - we are experiencing some issues with
88-
# that version on MacOS. 2.1.2/2.1.3 (and also some older versions) don't
89-
# have that problem
90-
unicorn_2_1_3 = python312Packages.buildPythonPackage rec {
91-
pname = "unicorn";
92-
version = "2.1.3";
93-
94-
propagatedBuildInputs = [
95-
python312Packages.setuptools
96-
];
97-
98-
build-system = with python312Packages; [
99-
setuptools
100-
];
101-
102-
dontConfigure = true;
103-
nativeBuildInputs =
104-
[
105-
cmake
106-
pkg-config
107-
];
108-
109-
src = fetchPypi {
110-
inherit pname version;
111-
hash = "sha256-DAZFbPVQwijyADzHA2avpK7OLm5+TDLY9LIscXumtyk=";
112-
};
113-
};
114-
11561
pythonEnv = python312.withPackages (ps: with ps; [
11662
ortools912
11763
sympy
118-
unicorn_2_1_3
64+
unicorn
11965
]);
12066

12167
in

nix/util.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ rec {
88
};
99

1010
wrap-gcc = p: p.buildPackages.wrapCCWith {
11-
cc = p.buildPackages.gcc14.cc;
11+
cc = p.buildPackages.gcc.cc;
1212
bintools = p.buildPackages.wrapBintoolsWith {
1313
bintools = p.buildPackages.binutils-unwrapped;
1414
libc = glibc-join p;
@@ -17,7 +17,7 @@ rec {
1717

1818
native-gcc =
1919
if pkgs.stdenv.isDarwin
20-
then pkgs.clang_16
20+
then pkgs.clang
2121
else wrap-gcc pkgs;
2222

2323
# cross is for determining whether to install the cross toolchain dependencies or not
@@ -39,7 +39,8 @@ rec {
3939
pkgs.lib.optionals cross [ pkgs.qemu x86_64-gcc aarch64-gcc riscv64-gcc ppc64le-gcc ]
4040
++ pkgs.lib.optionals (cross && pkgs.stdenv.isLinux && pkgs.stdenv.isx86_64) [ aarch64_be-gcc ]
4141
++ pkgs.lib.optionals cross [ native-gcc ]
42-
# NOTE: Tools in /Library/Developer/CommandLineTools/usr/bin on macOS are inaccessible in the Nix shell. This issue is addressed in https://github.com/NixOS/nixpkgs/pull/353893 but hasn’t been merged into the 24.11 channel yet. As a workaround, we include this dependency for macOS temporary.
42+
# git is not available in the nix shell on Darwin. As a workaround we add git as a dependency here.
43+
# Initially, we expected this to be fixed by https://github.com/NixOS/nixpkgs/pull/353893, but that does not seem to be the case.
4344
++ pkgs.lib.optionals (pkgs.stdenv.isDarwin) [ pkgs.git ]
4445
++ builtins.attrValues {
4546
inherit (pkgs.python3Packages) sympy pyyaml;
@@ -75,10 +76,10 @@ rec {
7576
name = "pqcp-linters";
7677
paths = builtins.attrValues {
7778
clang-tools = pkgs.clang-tools.overrideAttrs {
78-
unwrapped = pkgs.llvmPackages_18.clang-unwrapped;
79+
unwrapped = pkgs.llvmPackages.clang-unwrapped;
7980
};
8081

81-
inherit (pkgs.llvmPackages_18)
82+
inherit (pkgs.llvmPackages)
8283
bintools;
8384

8485
inherit (pkgs)

0 commit comments

Comments
 (0)