diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 1b3cd00a41..0ed1c2b0e5 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -235,7 +235,7 @@ itertools = "^0" regex = "^1" semver = "^1" -v8 = "=130.0.7" # Exact version +v8 = "=130.0.7" # Exact version NOTE: Do not forget to update version and hash in flake.nix deno_fetch = "0.214.0" deno_tls = "0.177.0" deno_console = "0.190.0" diff --git a/flake.nix b/flake.nix index 447f498531..f9df73f465 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,8 @@ config.allowUnfree = true; overlays = [ (import rust-overlay) ]; }; + lib = pkgs.lib; + stdenv = pkgs.stdenv; rust = pkgs.rust-bin.stable.latest.default.override { extensions = [ "rust-src" # for rust-analyzer @@ -26,6 +28,7 @@ libxml2.dev xmlsec.dev libxslt.dev + libclang.dev libtool nodejs postgresql @@ -42,16 +45,15 @@ PKG_CONFIG_PATH = pkgs.lib.makeSearchPath "lib/pkgconfig" (with pkgs; [ openssl.dev libxml2.dev xmlsec.dev libxslt.dev ]); RUSTY_V8_ARCHIVE = let - version = "130.0.1"; + # NOTE: needs to be same as in Cargo.toml + version = "130.0.7"; target = pkgs.hostPlatform.rust.rustcTarget; sha256 = { x86_64-linux = - "sha256-qc25H3Aj2KRhsAZ+2SD1c4RmweVK07oW71opZXRuUoc="; - aarch64-linux = - "sha256-qc25H3Aj2KRhsAZ+2SD1c4RmweVK07oW71opZXRuUoc="; + "sha256-pkdsuU6bAkcIHEZUJOt5PXdzK424CEgTLXjLtQ80t10="; + aarch64-linux = pkgs.lib.fakeHash; x86_64-darwin = pkgs.lib.fakeHash; - aarch64-darwin = - "sha256-d1QTLt8gOUFxACes4oyIYgDF/srLOEk+5p5Oj1ECajQ="; + aarch64-darwin = pkgs.lib.fakeHash; }.${system}; in pkgs.fetchurl { name = "librusty_v8-${version}"; @@ -77,25 +79,31 @@ devShells.default = pkgs.mkShell { buildInputs = buildInputs ++ (with pkgs; [ + # Essentials rust git xcaddy sqlx-cli - flock sccache nsjail - deno + + # Python + flock python3 python3Packages.pip + uv + + # Other languages + deno + nushell go bun - uv - nushell dotnet-sdk_9 oracle-instantclient + ansible + # LSP/Local dev svelte-language-server - ansible taplo ]); packages = [ @@ -185,6 +193,40 @@ ANSIBLE_GALAXY_PATH = "${pkgs.ansible}/bin/ansible-galaxy"; RUST_LOG = "debug"; SQLX_OFFLINE = "true"; + + # See this issue: https://github.com/NixOS/nixpkgs/issues/370494 + # Allows to build jemalloc on nixos + CFLAGS = "-Wno-error=int-conversion"; + + # Need to tell bindgen where to find libclang + LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; + + # LD_LIBRARY_PATH = "${pkgs.gcc.lib}/lib"; + + # Set C flags for Rust's bindgen program. Unlike ordinary C + # compilation, bindgen does not invoke $CC directly. Instead it + # uses LLVM's libclang. To make sure all necessary flags are + # included we need to look in a few places. + # See https://web.archive.org/web/20220523141208/https://hoverbear.org/blog/rust-bindgen-in-nix/ + BINDGEN_EXTRA_CLANG_ARGS = + "${builtins.readFile "${stdenv.cc}/nix-support/libc-crt1-cflags"} ${ + builtins.readFile "${stdenv.cc}/nix-support/libc-cflags" + }${builtins.readFile "${stdenv.cc}/nix-support/cc-cflags"}${ + builtins.readFile "${stdenv.cc}/nix-support/libcxx-cxxflags" + } -idirafter ${pkgs.libiconv}/include ${ + lib.optionalString stdenv.cc.isClang + "-idirafter ${stdenv.cc.cc}/lib/clang/${ + lib.getVersion stdenv.cc.cc + }/include" + }${ + lib.optionalString stdenv.cc.isGNU + "-isystem ${stdenv.cc.cc}/include/c++/${ + lib.getVersion stdenv.cc.cc + } -isystem ${stdenv.cc.cc}/include/c++/${ + lib.getVersion stdenv.cc.cc + }/${stdenv.hostPlatform.config} -idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/14.2.1/include" + }"; # NOTE: It is hardcoded to 14.2.1 -------------------------------------------------------------^^^^^^ + # Please update the version here as well if you want to update flake. }; packages.default = self.packages.${system}.windmill; packages.windmill-client = pkgs.buildNpmPackage {