Skip to content

fix(nix): Make sure bssl is in the PATH; workaround nix build failure… #2431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 1 addition & 191 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
description = "AWS-LC is a general-purpose cryptographic library";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nix, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
shells = import ./nix/devshell.nix { pkgs = pkgs; };

in rec {
packages.aws-lc = pkgs.stdenv.mkDerivation {
aws-lc = pkgs.stdenv.mkDerivation {
src = self;
name = "aws-lc";
inherit system;
nativeBuildInputs = [ pkgs.ninja pkgs.cmake pkgs.perl pkgs.go ];
# Workaround builds trying to write to $HOME: https://github.com/NixOS/nix/issues/670
preBuild = ''
export HOME=$PWD
'';
cmakeFlags = [
"-GNinja"
"-DBUILD_SHARED_LIBS=ON"
Expand All @@ -24,9 +28,15 @@
ninja run_minimal_tests
'';
};
shells = import ./nix/devshell.nix {
inherit pkgs;
inherit aws-lc;
};

in rec {
packages.aws-lc = aws-lc;
formatter = pkgs.nixfmt;
packages.default = packages.aws-lc;
devShells.default = shells;
});
}

18 changes: 13 additions & 5 deletions nix/devshell.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{ pkgs }:
{ pkgs, aws-lc }:
pkgs.mkShell rec {
buildInputs = [ pkgs.cmake ];
packages = [ pkgs.nixfmt-classic pkgs.ninja pkgs.cmake pkgs.perl pkgs.go ];
buildInputs = [
pkgs.cmake
pkgs.nixfmt-classic
pkgs.ninja
pkgs.perl
pkgs.go
aws-lc
];

shellHook = ''
echo "Entering a devShell..."
export PS1="[awslc nix] $PS1"
# Set custom prompt with ANSI color
export PS1="\[\033[1;32m\][aws-lc]\[\033[0m\] $PS1"
echo -e "\033[1;32mEntering AWS-LC development shell...\033[0m"
function clean {(set -e
rm -rf ./build
)}
Expand Down
Loading