aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kvapil2024-03-26 09:42:18 +0100
committerJan Kvapil2024-03-26 09:42:18 +0100
commite256dd0b807d9f05a6d45c69bd551dad66b8b670 (patch)
treed8aa1c560d93f79b125116c9bc36a5bd8580410d
parent3071464b109ab9310365f32370386a4587b81e83 (diff)
downloadECTester-e256dd0b807d9f05a6d45c69bd551dad66b8b670.tar.gz
ECTester-e256dd0b807d9f05a6d45c69bd551dad66b8b670.tar.zst
ECTester-e256dd0b807d9f05a6d45c69bd551dad66b8b670.zip
Add build with Nix flakes
-rw-r--r--flake.lock61
-rw-r--r--flake.nix119
2 files changed, 180 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..355cf24
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1710146030,
+ "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1711001935,
+ "narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "20f77aa09916374aa3141cbc605c955626762c9a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..d9113b6
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,119 @@
+{
+ description = "ECTester";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ overlays = [ ];
+ pkgs = import nixpkgs {
+ inherit system overlays;
+ };
+ # pythonPackages = with pkgs.python310Packages; [
+ # venvShellHook
+ # pyyaml
+ # numpy
+ # jinja2
+ # typing-extensions
+ # ];
+ in
+ with pkgs;
+ {
+ devShells.default = mkShell rec {
+ buildInputs = [
+ ant
+ jdk11
+ pkg-config
+ global-platform-pro
+ # libraries to test
+ openssl
+ boringssl
+ libressl
+ libtomcrypt
+ libtommath
+ botan2
+ cryptopp
+
+ # libraries' dependencies
+ cmake
+ ninja
+ gawk
+ automake
+ go
+ gtest
+ libunwind
+ autoconf
+ libb64
+
+ clang
+ libgcrypt
+ mbedtls
+ nasm
+ libtool
+ perl
+
+ wolfssl
+ nettle
+ libressl
+ ];
+
+ LD_LIBRARY_PATH = with pkgs; pkgs.lib.makeLibraryPath [
+ libtomcrypt
+ cryptopp
+ ];
+
+ # NOTE: Mixing postVenvCreation aznd shellHook results in only shellHook being called
+ # shellHook = ''
+ # source ${venvDir}/bin/activate
+ # export PATH=$PATH:$HOME/projects/ts-spect-compiler/build/src/apps;
+ # export TS_REPO_ROOT=`pwd`;
+ # '';
+ buildBoringSSL = ''
+ mkdir --parents build
+ pushd build
+ cmake -GNinja -DBUILD_SHARED_LIBS=1 ..
+ ninja
+ popd
+ '';
+
+ buildLibreSSL = ''
+ ./autogen.sh
+ mkdir --parents build
+ pushd build
+ cmake -GNinja -DBUILD_SHARED_LIBS=1 ..
+ ninja
+ popd
+ '';
+
+ buildIppCrypto = ''
+ CC=clang CXX=clang++ cmake CMakeLists.txt -GNinja -Bbuild -DARCH=intel64 # Does not work with GCC 12+
+ mkdir --parents build
+ pushd build
+ ninja
+ popd
+ '';
+
+ # shellHook = ''
+ # git submodule update --init --recursive
+
+ # pushd ext/boringssl
+ # ${buildBoringSSL}
+ # popd
+
+ # pushd ext/ipp-crypto
+ # ${buildIppCrypto}
+ # popd
+
+ # pushd ext/libressl
+ # ${buildLibreSSL}
+ # popd
+ # '';
+
+ };
+ }
+ );
+}