Skip to content

Commit a7ccb7e

Browse files
authored
nix devShell with aws-lc (#4028)
1 parent 382847c commit a7ccb7e

File tree

3 files changed

+142
-5
lines changed

3 files changed

+142
-5
lines changed

flake.lock

+122-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
description = "A flake for s2n-tls";
33

44
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
5+
# TODO: https://github.com/aws/aws-lc/pull/830
6+
inputs.awslc.url = "github:dougch/aws-lc?ref=nix";
57

6-
outputs = { self, nix, nixpkgs, flake-utils }:
8+
outputs = { self, nix, nixpkgs, awslc, flake-utils }:
79
flake-utils.lib.eachDefaultSystem (system:
810
let
911
pkgs = nixpkgs.legacyPackages.${system};
12+
aws-lc = awslc.packages.${system}.aws-lc;
1013
# TODO: We have parts of our CI that rely on clang-format-15, but that is only available on github:nixos/nixpkgs/nixos-unstable
1114
llvmPkgs = pkgs.llvmPackages_14;
1215
pythonEnv = import ./nix/pyenv.nix { pkgs = pkgs; };
@@ -143,6 +146,21 @@
143146
'';
144147
});
145148

149+
devShells.awslc = devShells.default.overrideAttrs
150+
(finalAttrs: previousAttrs: {
151+
# Re-include cmake to update the environment with a new libcrypto.
152+
buildInputs = [ pkgs.cmake aws-lc ];
153+
S2N_LIBCRYPTO = "awslc";
154+
# Integ s_client/server tests expect openssl 1.1.1.
155+
# GnuTLS-cli and serv utilities needed for some integration tests.
156+
shellHook = ''
157+
echo Setting up $S2N_LIBCRYPTO environment from flake.nix...
158+
export PATH=${openssl_1_1_1}/bin:$PATH
159+
export PS1="[nix $S2N_LIBCRYPTO] $PS1"
160+
source ${writeScript ./nix/shell.sh}
161+
'';
162+
});
163+
146164
# Used to backup the devShell to s3 for caching.
147165
packages.devShell = devShells.default.inputDerivation;
148166
packages.default = packages.s2n-tls;

nix/shell.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function test_toolchain_counts {
113113
# This is a starting point for a unit test of the devShell.
114114
# The choosen S2N_LIBCRYPTO should be 2, and the others should be zero.
115115
banner "Checking the CMAKE_INCLUDE_PATH for libcrypto counts"
116-
echo $CMAKE_INCLUDE_PATH|gawk 'BEGIN{RS=":"; o10=0; o11=0; o3=0;awslc=0}
116+
echo $CMAKE_INCLUDE_PATH|gawk 'BEGIN{RS=":"; o10=0; o11=0; o3=0;awslc=0;libre=0}
117117
/openssl-3.0/{o3++}
118118
/openssl-1.1/{o11++}
119119
/openssl-1.0/{o10++}

0 commit comments

Comments
 (0)