diff --git a/flake.lock b/flake.lock index 06b9b47af..b5d9c7a04 100644 --- a/flake.lock +++ b/flake.lock @@ -1,43 +1,43 @@ { "nodes": { "nixpkgs": { "locked": { - "lastModified": 1663905476, - "narHash": "sha256-0CSwRKaYravh9v6qSlBpM0gNg0UhKT2lL7Yn6Zbx7UM=", + "lastModified": 1666603677, + "narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e14f9fb57315f0d4abde222364f19f88c77d2b79", + "rev": "074da18a72269cc5a6cf444dce42daea5649b2fe", "type": "github" }, "original": { "owner": "nixos", "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { "nixpkgs": "nixpkgs", "utils": "utils" } }, "utils": { "locked": { "lastModified": 1638122382, "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", "owner": "numtide", "repo": "flake-utils", "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", "type": "github" }, "original": { "owner": "numtide", "repo": "flake-utils", "type": "github" } } }, "root": "root", "version": 7 } diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix index b125e32fa..8558c7afa 100644 --- a/nix/dev-shell.nix +++ b/nix/dev-shell.nix @@ -1,140 +1,142 @@ { mkShell , stdenv , lib , amqp-cpp , arcanist , aws-sdk-cpp , better-prompt , boost , c-ares_cmake-config , cargo , cmake , cmake-format , cocoapods , corrosion , cryptopp , darwin , double-conversion , folly , fmt , glog , grpc , gtest , libiconv , libuv , localstack , mariadb , mariadb-up -, nodejs-16_x +, nodejs-16_x-openssl_1_1 , olm , openjdk8 , openssl , pkg-config , protobuf_3_15_cmake , python3 , redis , redis-up , rustc , rustup , shellcheck , sqlite , terraform , watchman , rustfmt , yarn }: mkShell { # programs which are meant to be executed should go here nativeBuildInputs = [ # generic development or tools arcanist shellcheck terraform # node development mariadb - nodejs-16_x + nodejs-16_x-openssl_1_1 yarn watchman # react native python3 redis # native dependencies # C/CXX toolchains are already brought in with mkShell # Identity Service cargo # includes rustc rustc # allow for direct invocation of rustc rustfmt rustup # Tunnelbroker + CMake amqp-cpp c-ares_cmake-config cryptopp cmake cmake-format # linting libuv - localstack + # Localstack is currently broken by partial update + # See https://github.com/NixOS/nixpkgs/pull/197572 + #localstack pkg-config protobuf_3_15_cmake grpc ] ++ lib.optionals stdenv.isDarwin [ cocoapods # needed for ios ]; # include any libraries buildInputs buildInputs = [ # protobuf exposes both a library and a command # thus should appear in both inputs protobuf_3_15_cmake aws-sdk-cpp # tunnelbroker corrosion # tunnelbroker double-conversion # tunnelbroker glog # tunnelbroker gtest # testing services folly # cpp tools fmt # needed for folly boost # needed for folly olm # needed for CryptoTools sqlite # needed for sqlite_orm openssl # needed for grpc ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices Security libiconv # identity service ]); JAVA_HOME = openjdk8.passthru.home; # shell commands to be ran upon entering shell shellHook = '' PRJ_ROOT=$(git rev-parse --show-toplevel) # Set development environment variable defaults source "${../scripts/source_development_defaults.sh}" # Cache development path for some use cases such as XCode "$PRJ_ROOT/scripts/save_path.sh" '' # Darwin condition can be removed once linux services are supported + lib.optionalString stdenv.isDarwin '' # Start MariaDB development services "${mariadb-up}"/bin/mariadb-up & mariadb_pid=$! "${redis-up}"/bin/redis-up & redis_pid=$! wait "$mariadb_pid" "$redis_pid" '' + '' # Provide decent bash prompt source "${better-prompt}/bin/better-prompt" echo "Welcome to Comm dev environment! :)" ''; } diff --git a/nix/overlay.nix b/nix/overlay.nix index f5c16a64d..fb5029245 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,129 +1,96 @@ # An overlay allows for a package set to be extended with new or modified packages # `final` refers to the package set with all overlays applied. # This allows for added or modified packages to be referenced with # all relevant changes final: # `prev` refers to the previous package set before this current overlay is applied. # This is cheaper for nix to evaluate, thus should be prefered over final when possible. prev: { # Patch aws-sdk-cpp to automatically pick up header location # specific to nixpkgs, as nixpkgs separates build-time and runtime # depencenies (a saving of 400MB in header + generated files). # In the case of c and c++, this means the header files are # located in a separate directory from the libraries. # # From a developer perspective, this avoids having to manually specify # the header location with `-DAWS_CORE_HEADER_FILE` each time # one invokes `cmake` on the command line when using # `find_package(AWSSDK COMPONENTS [comps])` # # For more information, see: # - aws-sdk-cpp issue: https://github.com/aws/aws-sdk-cpp/issues/2009 # - Nixpkgs fix: https://github.com/NixOS/nixpkgs/pull/182918 aws-sdk-cpp = (prev.aws-sdk-cpp.overrideAttrs(oldAttrs:{ postPatch = oldAttrs.postPatch + '' substituteInPlace cmake/AWSSDKConfig.cmake \ --replace 'C:/AWSSDK/''${AWSSDK_INSTALL_INCLUDEDIR}/aws/core' \ 'C:/AWSSDK/''${AWSSDK_INSTALL_INCLUDEDIR}/aws/core" "${placeholder "dev"}/include/aws/core' ''; })).override { # avoid rebuildilng all 300+ apis apis = [ "core" "s3" "dynamodb" ]; }; # add packages meant for just this repository amqp-cpp = prev.callPackage ./amqp-cpp.nix { }; arcanist = prev.callPackage ./arcanist.nix { }; better-prompt = prev.callPackage ./better-prompt.nix { }; # c-ares is used to bootstrap curl, so cmake is not available in the default # build c-ares_cmake-config = prev.c-ares.overrideAttrs(o: { nativeBuildInputs = (o.nativeBuildInputs or []) ++ [ prev.cmake ]; }); protobuf_3_15_cmake = prev.callPackage ./protobuf_3_15.nix { }; devShells.default = final.callPackage ./dev-shell.nix { }; devShell = final.devShells.default; localstack-down = prev.callPackage ./localstack-down.nix { }; localstack-up = prev.callPackage ./localstack-up.nix { }; # Make our version of mariadb the default everywhere mariadb = prev.mariadb_108; mariadb-up = prev.callPackage ./mariadb-up-mac.nix { }; mysql-down = prev.callPackage ./mysql-down-linux.nix { }; mysql-up = prev.callPackage ./mysql-up-linux.nix { }; redis-up = prev.callPackage ./redis-up-mac.nix { }; olm = prev.olm.overrideAttrs(oldAttrs: { # *.hh files aren't meant to be used externally # so we patch installation to add it postInstall = '' cp \ $NIX_BUILD_TOP/${oldAttrs.src.name}/include/olm/*.h* \ ''${!outputDev}/include/olm ''; }); corrosion = prev.corrosion.overrideAttrs(_: { patches = [ # Fix logic around finding cargo and rustc when not managed by rustup (prev.fetchpatch { url = "https://github.com/corrosion-rs/corrosion/commit/d5330b3f03c7abb4e4da71e35654fa03ecb778bb.patch"; sha256 = "sha256-jrA30bWNWprkqCiedf+xL7GlR9+9jgOyKAoTPVKkB9c="; }) ]; }); - # 16.14 now requires experimental import assertions syntax, pin to 16.13 - # https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md - # - # TODO: Use nodejs-16_x-openssl_1_1 once - # https://github.com/NixOS/nixpkgs/pull/195722 is merged. - # Related openssl issue: https://linear.app/comm/issue/ENG-2029 - nodejs-16_x = (prev.nodejs-16_x.overrideAttrs (oldAttrs: rec { - version = "16.13.0"; - name = "nodejs-${version}"; - - src = prev.fetchurl { - url = "https://nodejs.org/dist/v${version}/node-v${version}.tar.xz"; - sha256 = "sha256-MhFLPcOUXtD5X4vDO0LGjg7xjECMtWEiVyoWPZB+y8w="; - }; - - # Nixpkgs applies two patches for 16.15. One patch is for finding headers - # needed for v8 on darwin using apple_sdk 11; the other patch fixes crashes - # related cache dir defaulting to using `$HOME` without asserting that - # it exists. - # - # However, 16.13 doesn't need the second patch, as the regression which - # caused it was introduced after 16.13. This ends up being a no-op. But - # nix will still try to apply the patch and fail with "this patch has - # already been applied". - # - # For more context, see (https://github.com/npm/cli/pull/5197) - # - # lib.head will select the first element in an array - patches = [ - (prev.lib.head oldAttrs.patches) - ]; - })).override { openssl = prev.openssl_1_1; }; - # Ensure that yarn is using the pinned version yarn = prev.yarn.override (_: { - nodejs = final.nodejs-16_x; + nodejs = final.nodejs-16_x-openssl_1_1; }); }