From b99829f142a6de8360e282348b60b4c3c0f210b5 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 21 Jun 2020 21:40:55 +0100 Subject: fix(3p/nix): install nix_config.h and config.nix This also installs the rest of corepkgs as a side-effect. Change-Id: I67a42d45793d5e8fdad51c1f306eebf63e9c2868 Reviewed-on: https://cl.tvl.fyi/c/depot/+/548 Reviewed-by: tazjin --- third_party/nix/CMakeLists.txt | 9 +++++++++ third_party/nix/config.h.in | 12 ++++++------ third_party/nix/corepkgs/config.nix.in | 12 ++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) (limited to 'third_party') diff --git a/third_party/nix/CMakeLists.txt b/third_party/nix/CMakeLists.txt index f325f5a5d9..54bf362332 100644 --- a/third_party/nix/CMakeLists.txt +++ b/third_party/nix/CMakeLists.txt @@ -40,5 +40,14 @@ add_subdirectory(glog) # generate a configuration file (autoheader-style) to configure # certain symbols that Nix depends on. configure_file(config.h.in nix_config.h @ONLY) +INSTALL(FILES "${PROJECT_BINARY_DIR}/nix_config.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nix") + +# install corepkgs +configure_file(corepkgs/config.nix.in config.nix @ONLY) +INSTALL(DIRECTORY corepkgs + DESTINATION ${CMAKE_INSTALL_DATADIR}/nix + FILES_MATCHING + PATTERN "*.nix") +INSTALL(FILES "${PROJECT_BINARY_DIR}/config.nix" DESTINATION "${CMAKE_INSTALL_DATADIR}/nix/corepkgs") add_subdirectory(src) diff --git a/third_party/nix/config.h.in b/third_party/nix/config.h.in index 54855763d2..f0c3f06d0e 100644 --- a/third_party/nix/config.h.in +++ b/third_party/nix/config.h.in @@ -14,15 +14,15 @@ #define SYSTEM "x86_64-linux" // TODO(tazjin): some of these values are nonsensical for Nix -#define NIX_PREFIX "/usr/local" +#define NIX_PREFIX "@CMAKE_INSTALL_PREFIX@" #define NIX_STORE_DIR "/nix/store" -#define NIX_DATA_DIR "/usr/local/share" +#define NIX_DATA_DIR "@CMAKE_INSTALL_FULL_DATADIR@" #define NIX_LOG_DIR "/nix/var/log/nix" #define NIX_STATE_DIR "/nix/var/nix" -#define NIX_CONF_DIR "/usr/local/etc/nix" -#define NIX_LIBEXEC_DIR "/usr/local/libexec" -#define NIX_BIN_DIR "/usr/local/bin" -#define NIX_MAN_DIR "/usr/local/share/man" +#define NIX_CONF_DIR "/etc/nix" +#define NIX_LIBEXEC_DIR "@CMAKE_INSTALL_FULL_LIBEXECDIR@" +#define NIX_BIN_DIR "@CMAKE_INSTALL_FULL_BINDIR@" +#define NIX_MAN_DIR "@CMAKE_INSTALL_FULL_MANDIR@" #define SANDBOX_SHELL "/nix/store/zq8biwi5mj2lrn68kx0lk0fkpbqypyxd-busybox-1.31.1-x86_64-unknown-linux-musl/bin/busybox" diff --git a/third_party/nix/corepkgs/config.nix.in b/third_party/nix/corepkgs/config.nix.in index 32ce6b399f..0e4a2f0c90 100644 --- a/third_party/nix/corepkgs/config.nix.in +++ b/third_party/nix/corepkgs/config.nix.in @@ -11,12 +11,12 @@ in rec { tar = "@tar@"; tarFlags = "@tarFlags@"; tr = "@tr@"; - nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@"; - nixPrefix = "@prefix@"; - nixLibexecDir = fromEnv "NIX_LIBEXEC_DIR" "@libexecdir@"; - nixLocalstateDir = "@localstatedir@"; - nixSysconfDir = "@sysconfdir@"; - nixStoreDir = fromEnv "NIX_STORE_DIR" "@storedir@"; + nixBinDir = fromEnv "NIX_BIN_DIR" "@CMAKE_INSTALL_FULL_BINDIR@"; + nixPrefix = "@CMAKE_INSTALL_PREFIX@"; + nixLibexecDir = fromEnv "NIX_LIBEXEC_DIR" "@CMAKE_INSTALL_FULL_LIBEXECDIR@"; + nixLocalstateDir = "/nix/var"; + nixSysconfDir = "/etc"; + nixStoreDir = fromEnv "NIX_STORE_DIR" "/nix/store"; # If Nix is installed in the Nix store, then automatically add it as # a dependency to the core packages. This ensures that they work -- cgit 1.4.1