Skip to content

Commit

Permalink
Minor refactors (facebook#9116)
Browse files Browse the repository at this point in the history
Summary:
* Set CMake types in `CMAKE_INIT_CACHE` for type safety
* Rename `cmakeInitCache` to `CMAKE_INIT_CACHE` for naming consistency between the devShell and package.

Pull Request resolved: facebook#9116

Test Plan:
 ---
Check GitHub Actions

Reviewed By: alexeyt

Differential Revision: D37824787

Pulled By: Atry

fbshipit-source-id: 445ac2d2532d0000688a8edd150d6dfa8315f8be
  • Loading branch information
Atry authored and facebook-github-bot committed Jul 14, 2022
1 parent a7221fc commit 239493e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
pkgs.fpm
pkgs.rpm
];
NIX_CFLAGS_COMPILE = packages.hhvm.NIX_CFLAGS_COMPILE;
CMAKE_INIT_CACHE = packages.hhvm.cmakeInitCache;
inherit (packages.hhvm)
NIX_CFLAGS_COMPILE
CMAKE_INIT_CACHE;
};

${if pkgs.hostPlatform.isLinux then "bundlers" else null} =
Expand Down
8 changes: 4 additions & 4 deletions hhvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ stdenv.mkDerivation rec {
"-Wno-error=unused-command-line-argument"
];

cmakeInitCache =
CMAKE_INIT_CACHE =
let
# Use writeTextDir instead of writeTextFile as a workaround of https://github.com/xtruder/nix-devcontainer/issues/9
dir = writeTextDir "init-cache.cmake"
''
set(CAN_USE_SYSTEM_ZSTD ON CACHE BOOL "Use system zstd" FORCE)
set(HAVE_SYSTEM_TZDATA_PREFIX "${tzdata}/share/zoneinfo" CACHE STRING "The zoneinfo directory" FORCE)
set(HAVE_SYSTEM_TZDATA_PREFIX "${tzdata}/share/zoneinfo" CACHE PATH "The zoneinfo directory" FORCE)
set(HAVE_SYSTEM_TZDATA ON CACHE BOOL "Use system zoneinfo" FORCE)
set(MYSQL_UNIX_SOCK_ADDR "/run/mysqld/mysqld.sock" CACHE STRING "The MySQL unix socket" FORCE)
set(MYSQL_UNIX_SOCK_ADDR "/run/mysqld/mysqld.sock" CACHE FILEPATH "The MySQL unix socket" FORCE)
set(CARGO_EXECUTABLE "${rustNightly.cargo}/bin/cargo" CACHE FILEPATH "The nightly cargo" FORCE)
set(RUSTC_EXECUTABLE "${rustNightly.rust}/bin/rustc" CACHE FILEPATH "The nightly rustc" FORCE)
${
Expand All @@ -198,7 +198,7 @@ stdenv.mkDerivation rec {
in
dir + "/init-cache.cmake";

cmakeFlags = [ "-C" cmakeInitCache ];
cmakeFlags = [ "-C" CMAKE_INIT_CACHE ];

prePatch = ''
patchShebangs .
Expand Down

0 comments on commit 239493e

Please sign in to comment.