Skip to content

Commit 9cf5eac

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

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-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: 36 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,47 @@
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 = [ "no-docs" "no-tests" ];
70+
};
71+
"3.6" = {
72+
base = pkgs.openssl_3_6;
73+
version = "3.6.1";
74+
hash = "sha256-sb/tzVson/Iq7ofJ1gD1FXZ+v0X3cWjLbWTyMfUYqC4=";
75+
configureFlags = [ "no-docs" "no-tests" ];
76+
};
77+
};
78+
selected =
79+
opensslVersions.${opensslVersion}
80+
or (throw "Unsupported opensslVersion: ${opensslVersion}. Use \"1.1\", \"3.0\", \"3.5\", \"3.6\", or null for bundled.");
5281
in
5382
{
54-
openssl = pkgs.openssl_3_6.overrideAttrs (old: {
55-
inherit version;
83+
openssl = selected.base.overrideAttrs (old: {
84+
version = selected.version;
5685
src = pkgs.fetchurl {
57-
url = builtins.replaceStrings [ old.version ] [ version ] old.src.url;
58-
hash = "sha256-soyRUyqLZaH5g7TCi3SIF05KAQCOKc6Oab14nyi8Kok=";
86+
url = builtins.replaceStrings [ old.version ] [ selected.version ] old.src.url;
87+
hash = selected.hash;
5988
};
6089
doCheck = false;
61-
configureFlags = (old.configureFlags or [ ]) ++ [
62-
"no-docs"
63-
"no-tests"
64-
];
90+
configureFlags = (old.configureFlags or [ ]) ++ selected.configureFlags;
6591
outputs = [
6692
"bin"
6793
"out"

0 commit comments

Comments
 (0)