Skip to content

Commit 49e857d

Browse files
committed
tools: add opensslVersion parameter to nix-shell
1 parent 53bcd11 commit 49e857d

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

shell.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
withSQLite ? true,
1919
withSSL ? true,
2020
withTemporal ? false,
21+
opensslVersion ? "3.5", # "1.1", "3.0", "3.5", "3.6", or null for bundled
2122
sharedLibDeps ?
2223
let
2324
d = import ./tools/nix/sharedLibDeps.nix {
@@ -28,6 +29,7 @@
2829
withSQLite
2930
withSSL
3031
withTemporal
32+
opensslVersion
3133
;
3234
};
3335
in

tools/nix/sharedLibDeps.nix

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
withSQLite ? true,
66
withSSL ? true,
77
withTemporal ? false,
8+
opensslVersion ? "3.5",
89
}:
910
{
1011
inherit (pkgs)
@@ -46,22 +47,53 @@
4647
// (pkgs.lib.optionalAttrs withSQLite {
4748
inherit (pkgs) sqlite;
4849
})
49-
// (pkgs.lib.optionalAttrs withSSL (
50+
// (pkgs.lib.optionalAttrs (withSSL && opensslVersion != null) (
5051
let
51-
version = "3.5.5";
52+
opensslVersions = {
53+
"1.1" = {
54+
base = pkgs.openssl_1_1;
55+
version = "1.1.1w";
56+
hash = "sha256-zzCYlQy02FOtlcCEHx+cbT3BAtzPys1SHZOSUgi3asg=";
57+
configureFlags = [ "no-tests" ];
58+
};
59+
"3.0" = {
60+
base = pkgs.openssl_3;
61+
version = "3.0.19";
62+
hash = "sha256-+lpBQ7iq4YvlPvLzyvKaLgdHQwuLx00y2IM1uUq2MHI=";
63+
configureFlags = [ "no-tests" ];
64+
};
65+
"3.5" = {
66+
base = pkgs.openssl_3_5;
67+
version = "3.5.5";
68+
hash = "sha256-soyRUyqLZaH5g7TCi3SIF05KAQCOKc6Oab14nyi8Kok=";
69+
configureFlags = [
70+
"no-docs"
71+
"no-tests"
72+
];
73+
};
74+
"3.6" = {
75+
base = pkgs.openssl_3_6;
76+
version = "3.6.1";
77+
hash = "sha256-sb/tzVson/Iq7ofJ1gD1FXZ+v0X3cWjLbWTyMfUYqC4=";
78+
configureFlags = [
79+
"no-docs"
80+
"no-tests"
81+
];
82+
};
83+
};
84+
selected =
85+
opensslVersions.${opensslVersion}
86+
or (throw "Unsupported opensslVersion: ${opensslVersion}. Use \"1.1\", \"3.0\", \"3.5\", \"3.6\", or null for bundled.");
5287
in
5388
{
54-
openssl = pkgs.openssl_3_6.overrideAttrs (old: {
55-
inherit version;
89+
openssl = selected.base.overrideAttrs (old: {
90+
version = selected.version;
5691
src = pkgs.fetchurl {
57-
url = builtins.replaceStrings [ old.version ] [ version ] old.src.url;
58-
hash = "sha256-soyRUyqLZaH5g7TCi3SIF05KAQCOKc6Oab14nyi8Kok=";
92+
url = builtins.replaceStrings [ old.version ] [ selected.version ] old.src.url;
93+
hash = selected.hash;
5994
};
6095
doCheck = false;
61-
configureFlags = (old.configureFlags or [ ]) ++ [
62-
"no-docs"
63-
"no-tests"
64-
];
96+
configureFlags = (old.configureFlags or [ ]) ++ selected.configureFlags;
6597
outputs = [
6698
"bin"
6799
"out"

0 commit comments

Comments
 (0)