about summary refs log tree commit diff
path: root/third_party/nix/src
diff options
context:
space:
mode:
authorp01arst0rm <polar@ever3st.com>2019-10-21T16·57+0100
committerVincent Ambo <tazjin@google.com>2020-05-17T14·55+0100
commit055139ac6aaecc7193972b65d2bcca022969c61d (patch)
tree3fb9b6c3aee1a06a40ee3edda1c41ff7df95a9ab /third_party/nix/src
parentc455f7a987fff8fef459d340865368b1da28cecd (diff)
feat(3p/nix): added meson support r/726
(cherry picked from commit 086a81b7a5bbe1fc022efb5935ff68f6ad71ddaf)
Diffstat (limited to 'third_party/nix/src')
-rw-r--r--third_party/nix/src/libexpr/meson.build130
-rw-r--r--third_party/nix/src/libmain/meson.build79
-rw-r--r--third_party/nix/src/libstore/meson.build170
-rw-r--r--third_party/nix/src/libstore/remote-store.cc2
-rw-r--r--third_party/nix/src/libutil/meson.build106
-rw-r--r--third_party/nix/src/libutil/util.cc4
-rw-r--r--third_party/nix/src/meson.build48
-rwxr-xr-xthird_party/nix/src/nix-build/nix-build.cc2
-rw-r--r--third_party/nix/src/nix/main.cc3
-rw-r--r--third_party/nix/src/nix/meson.build152
-rw-r--r--third_party/nix/src/resolve-system-dependencies/meson.build58
11 files changed, 750 insertions, 4 deletions
diff --git a/third_party/nix/src/libexpr/meson.build b/third_party/nix/src/libexpr/meson.build
new file mode 100644
index 000000000000..a5371a251c7c
--- /dev/null
+++ b/third_party/nix/src/libexpr/meson.build
@@ -0,0 +1,130 @@
+# Nix lib expr build file
+#============================================================================
+
+
+
+
+# src files
+#============================================================================
+
+src_inc += include_directories('.', 'primops')
+
+libexpr_src = files(
+    join_paths(meson.source_root(), 'src/libexpr/primops/context.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/primops/fetchGit.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/primops/fetchMercurial.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/primops/fromTOML.cc'),
+
+    join_paths(meson.source_root(), 'src/libexpr/attr-path.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/attr-set.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/common-eval-args.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/eval.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/get-drvs.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/json-to-value.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/names.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/nixexpr.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/primops.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/value-to-json.cc'),
+    join_paths(meson.source_root(), 'src/libexpr/value-to-xml.cc'))
+
+libexpr_headers = files(
+    join_paths(meson.source_root(), 'src/libexpr/attr-path.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/attr-set.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/common-eval-args.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/eval.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/eval-inline.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/function-trace.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/get-drvs.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/json-to-value.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/names.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/nixexpr.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/primops.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/symbol-table.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/value.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/value-to-json.hh'),
+    join_paths(meson.source_root(), 'src/libexpr/value-to-xml.hh'))
+
+
+
+
+# dependancies
+#============================================================================
+
+libexpr_dep_list = [
+    libdl_dep,
+    libsodium_dep]
+
+if sys_name == 'freebsd'
+    libexpr_dep_list += libdl_dep
+endif
+
+
+
+
+# Link args
+#============================================================================
+
+libexpr_link_list = [
+    libutil_lib,
+    libstore_lib,
+    libmain_lib]
+
+libexpr_link_args = []
+
+
+
+
+# compiler args
+#============================================================================
+
+libexpr_cxx_args = []
+
+
+
+
+# targets
+#============================================================================
+
+libexpr_src += custom_target(
+    'parser_tab.[cchh]',
+    output : [
+        'parser-tab.cc',
+        'parser-tab.hh'],
+    input : 'parser.y',
+    command : [
+        bison,
+        '-v',
+        '--output=@OUTPUT0@',
+        '@INPUT@',
+        '-d'])
+
+libexpr_src += custom_target(
+    'lexer_tab.[cchh]',
+    output : ['lexer-tab.cc', 'lexer-tab.hh'],
+    input : 'lexer.l',
+    command : [
+        flex,
+        '--outfile=@OUTPUT0@',
+        '--header-file=@OUTPUT1@',
+        '@INPUT@'])
+
+
+
+
+# build
+#============================================================================
+
+libexpr_lib = library(
+    'nixexpr',
+    install : true,
+    install_mode : 'rwxr-xr-x',
+    install_dir : libdir,
+    include_directories : src_inc,
+    link_with : libexpr_link_list,
+    sources : libexpr_src,
+    link_args : libexpr_link_args,
+    dependencies : libexpr_dep_list)
+
+install_headers(
+    libexpr_headers,
+    install_dir : join_paths(includedir, 'nix'))
diff --git a/third_party/nix/src/libmain/meson.build b/third_party/nix/src/libmain/meson.build
new file mode 100644
index 000000000000..ec510ee2e5b8
--- /dev/null
+++ b/third_party/nix/src/libmain/meson.build
@@ -0,0 +1,79 @@
+# Nix lib store build file
+#============================================================================
+
+
+
+
+# src files
+#============================================================================
+
+src_inc += include_directories('.')
+
+libmain_src = files(
+    join_paths(meson.source_root(), 'src/libmain/common-args.cc'),
+    join_paths(meson.source_root(), 'src/libmain/shared.cc'),
+    join_paths(meson.source_root(), 'src/libmain/stack.cc'))
+
+libmain_headers = files(
+    join_paths(meson.source_root(), 'src/libmain/common-args.hh'),
+    join_paths(meson.source_root(), 'src/libmain/shared.hh'))
+
+
+
+
+# dependancies
+#============================================================================
+
+libmain_dep_list = [
+    pthread_dep,
+    openssl_dep,
+    libsodium_dep]
+
+
+
+
+
+# Link args
+#============================================================================
+
+libmain_link_list = [
+    libutil_lib,
+    libstore_lib
+]
+
+libmain_link_args = []
+
+
+
+
+# compiler args
+#============================================================================
+
+libstore_cxx_args = []
+
+
+
+
+# targets
+#============================================================================
+
+
+
+
+# build
+#============================================================================
+
+libmain_lib = library(
+    'nixmain',
+    install : true,
+    install_mode : 'rwxr-xr-x',
+    install_dir : libdir,
+    include_directories : src_inc,
+    link_with : libmain_link_list,
+    sources : libmain_src,
+    link_args : libmain_link_args,
+    dependencies : libmain_dep_list)
+
+install_headers(
+    libmain_headers,
+    install_dir : join_paths(includedir, 'nix'))
diff --git a/third_party/nix/src/libstore/meson.build b/third_party/nix/src/libstore/meson.build
new file mode 100644
index 000000000000..28ae0fdb2733
--- /dev/null
+++ b/third_party/nix/src/libstore/meson.build
@@ -0,0 +1,170 @@
+# Nix lib store build file
+#============================================================================
+
+
+
+
+# src files
+#============================================================================
+
+src_inc += include_directories('.')
+
+libstore_src = files(
+    join_paths(meson.source_root(), 'src/libstore/binary-cache-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/build.cc'),
+    join_paths(meson.source_root(), 'src/libstore/crypto.cc'),
+    join_paths(meson.source_root(), 'src/libstore/derivations.cc'),
+    join_paths(meson.source_root(), 'src/libstore/download.cc'),
+    join_paths(meson.source_root(), 'src/libstore/export-import.cc'),
+    join_paths(meson.source_root(), 'src/libstore/gc.cc'),
+    join_paths(meson.source_root(), 'src/libstore/globals.cc'),
+    join_paths(meson.source_root(), 'src/libstore/http-binary-cache-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/legacy-ssh-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/local-binary-cache-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/local-fs-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/local-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/machines.cc'),
+    join_paths(meson.source_root(), 'src/libstore/misc.cc'),
+    join_paths(meson.source_root(), 'src/libstore/nar-accessor.cc'),
+    join_paths(meson.source_root(), 'src/libstore/nar-info.cc'),
+    join_paths(meson.source_root(), 'src/libstore/nar-info-disk-cache.cc'),
+    join_paths(meson.source_root(), 'src/libstore/optimise-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/parsed-derivations.cc'),
+    join_paths(meson.source_root(), 'src/libstore/pathlocks.cc'),
+    join_paths(meson.source_root(), 'src/libstore/profiles.cc'),
+    join_paths(meson.source_root(), 'src/libstore/references.cc'),
+    join_paths(meson.source_root(), 'src/libstore/remote-fs-accessor.cc'),
+    join_paths(meson.source_root(), 'src/libstore/remote-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/s3-binary-cache-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/sqlite.cc'),
+    join_paths(meson.source_root(), 'src/libstore/ssh.cc'),
+    join_paths(meson.source_root(), 'src/libstore/ssh-store.cc'),
+    join_paths(meson.source_root(), 'src/libstore/store-api.cc'),
+    join_paths(meson.source_root(), 'src/libstore/builtins/buildenv.cc'),
+    join_paths(meson.source_root(), 'src/libstore/builtins/fetchurl.cc'))
+
+libstore_headers = files(
+    join_paths(meson.source_root(), 'src/libstore/binary-cache-store.hh'),
+    join_paths(meson.source_root(), 'src/libstore/builtins.hh'),
+    join_paths(meson.source_root(), 'src/libstore/crypto.hh'),
+    join_paths(meson.source_root(), 'src/libstore/derivations.hh'),
+    join_paths(meson.source_root(), 'src/libstore/download.hh'),
+    join_paths(meson.source_root(), 'src/libstore/fs-accessor.hh'),
+    join_paths(meson.source_root(), 'src/libstore/globals.hh'),
+    join_paths(meson.source_root(), 'src/libstore/local-store.hh'),
+    join_paths(meson.source_root(), 'src/libstore/machines.hh'),
+    join_paths(meson.source_root(), 'src/libstore/nar-accessor.hh'),
+    join_paths(meson.source_root(), 'src/libstore/nar-info-disk-cache.hh'),
+    join_paths(meson.source_root(), 'src/libstore/nar-info.hh'),
+    join_paths(meson.source_root(), 'src/libstore/parsed-derivations.hh'),
+    join_paths(meson.source_root(), 'src/libstore/pathlocks.hh'),
+    join_paths(meson.source_root(), 'src/libstore/profiles.hh'),
+    join_paths(meson.source_root(), 'src/libstore/references.hh'),
+    join_paths(meson.source_root(), 'src/libstore/remote-fs-accessor.hh'),
+    join_paths(meson.source_root(), 'src/libstore/remote-store.hh'),
+    join_paths(meson.source_root(), 'src/libstore/s3-binary-cache-store.hh'),
+    join_paths(meson.source_root(), 'src/libstore/s3.hh'),
+    join_paths(meson.source_root(), 'src/libstore/serve-protocol.hh'),
+    join_paths(meson.source_root(), 'src/libstore/sqlite.hh'),
+    join_paths(meson.source_root(), 'src/libstore/ssh.hh'),
+    join_paths(meson.source_root(), 'src/libstore/store-api.hh'),
+    join_paths(meson.source_root(), 'src/libstore/worker-protocol.hh'))
+
+libstore_data = files(
+    join_paths(meson.source_root(), 'src/libstore/sandbox-defaults.sb'),
+    join_paths(meson.source_root(), 'src/libstore/sandbox-minimal.sb'),
+    join_paths(meson.source_root(), 'src/libstore/sandbox-network.sb'))
+
+# dependancies
+#============================================================================
+
+libstore_dep_list = [
+    libbz2_dep,
+    libcurl_dep,
+    libdl_dep,
+    pthread_dep,
+    sqlite3_dep,
+    libsodium_dep
+]
+
+if sys_name.contains('linux')
+    libstore_dep_list += libseccomp_dep
+endif
+
+if sys_name.contains('freebsd')
+    libstore_dep_list += libdl_dep
+endif
+
+
+
+
+# Link args
+#============================================================================
+
+libstore_link_list = [
+    libutil_lib]
+
+libstore_link_args = []
+
+
+
+
+# compiler args
+#============================================================================
+
+libstore_cxx_args = [
+    '-DNIX_PREFIX="@0@" '.format(prefix),
+    '-DNIX_STORE_DIR="@0@" '.format(nixstoredir),
+    '-DNIX_DATA_DIR="@0@" '.format(datadir),
+    '-DNIX_STATE_DIR="@0@" '.format(join_paths(localstatedir, 'nix')),
+    '-DNIX_LOG_DIR="@0@" '.format(join_paths(localstatedir, 'log/nix')),
+    '-DNIX_CONF_DIR="@0@" '.format(join_paths(sysconfdir, 'nix')),
+    '-DNIX_LIBEXEC_DIR="@0@" '.format(libexecdir),
+    '-DNIX_BIN_DIR="@0@" '.format(bindir),
+    '-DNIX_MAN_DIR="@0@" '.format(mandir),
+    '-DSANDBOX_SHELL="@0@" '.format(get_option('sandbox_shell')),
+    '-DLSOF="@0@" '.format(lsof)]
+
+
+
+
+# targets
+#============================================================================
+
+gen_header = '''
+  echo 'R"foo(' >> "$1"
+  cat @INPUT@ >> "$1"
+  echo ')foo"' >> "$1"
+'''
+
+libstore_src += custom_target(
+  'schema.sql.gen.hh',
+  output : 'schema.sql.gen.hh',
+  input : 'schema.sql',
+  command : [bash, '-c', gen_header, 'sh', '@OUTPUT@'])
+
+
+
+
+# build
+#============================================================================
+
+libstore_lib = library(
+    'nixstore',
+    install : true,
+    install_mode : 'rwxr-xr-x',
+    install_dir : libdir,
+    include_directories : src_inc,
+    link_with : libstore_link_list,
+    sources : libstore_src,
+    cpp_args : libstore_cxx_args,
+    link_args : libstore_link_args,
+    dependencies : libstore_dep_list)
+
+install_headers(
+    libstore_headers,
+    install_dir : join_paths(includedir, 'nix'))
+
+install_data(
+    libstore_data,
+    install_dir : join_paths(datadir, 'nix/sandbox'))
diff --git a/third_party/nix/src/libstore/remote-store.cc b/third_party/nix/src/libstore/remote-store.cc
index f34369d8fe0a..e21f3449b0ef 100644
--- a/third_party/nix/src/libstore/remote-store.cc
+++ b/third_party/nix/src/libstore/remote-store.cc
@@ -229,7 +229,7 @@ struct ConnectionHandle
 
     ~ConnectionHandle()
     {
-        if (!daemonException && std::uncaught_exception()) {
+        if (!daemonException && std::uncaught_exceptions()) {
             handle.markBad();
             debug("closing daemon connection because of an exception");
         }
diff --git a/third_party/nix/src/libutil/meson.build b/third_party/nix/src/libutil/meson.build
new file mode 100644
index 000000000000..c6eec21c5ae8
--- /dev/null
+++ b/third_party/nix/src/libutil/meson.build
@@ -0,0 +1,106 @@
+# Nix lib store build file
+#============================================================================
+
+
+
+
+# src files
+#============================================================================
+
+src_inc += include_directories('.')
+
+libutil_src = files(
+    join_paths(meson.source_root(), 'src/libutil/affinity.cc'),
+    join_paths(meson.source_root(), 'src/libutil/archive.cc'),
+    join_paths(meson.source_root(), 'src/libutil/args.cc'),
+    join_paths(meson.source_root(), 'src/libutil/compression.cc'),
+    join_paths(meson.source_root(), 'src/libutil/config.cc'),
+    join_paths(meson.source_root(), 'src/libutil/hash.cc'),
+    join_paths(meson.source_root(), 'src/libutil/json.cc'),
+    join_paths(meson.source_root(), 'src/libutil/logging.cc'),
+    join_paths(meson.source_root(), 'src/libutil/serialise.cc'),
+    join_paths(meson.source_root(), 'src/libutil/thread-pool.cc'),
+    join_paths(meson.source_root(), 'src/libutil/util.cc'),
+    join_paths(meson.source_root(), 'src/libutil/xml-writer.cc'))
+
+libutil_headers = files(
+    join_paths(meson.source_root(), 'src/libutil/affinity.hh'),
+    join_paths(meson.source_root(), 'src/libutil/archive.hh'),
+    join_paths(meson.source_root(), 'src/libutil/args.hh'),
+    join_paths(meson.source_root(), 'src/libutil/compression.hh'),
+    join_paths(meson.source_root(), 'src/libutil/config.hh'),
+    join_paths(meson.source_root(), 'src/libutil/finally.hh'),
+    join_paths(meson.source_root(), 'src/libutil/hash.hh'),
+    join_paths(meson.source_root(), 'src/libutil/istringstream_nocopy.hh'),
+    join_paths(meson.source_root(), 'src/libutil/json.hh'),
+    join_paths(meson.source_root(), 'src/libutil/lazy.hh'),
+    join_paths(meson.source_root(), 'src/libutil/logging.hh'),
+    join_paths(meson.source_root(), 'src/libutil/lru-cache.hh'),
+    join_paths(meson.source_root(), 'src/libutil/monitor-fd.hh'),
+    join_paths(meson.source_root(), 'src/libutil/pool.hh'),
+    join_paths(meson.source_root(), 'src/libutil/ref.hh'),
+    join_paths(meson.source_root(), 'src/libutil/serialise.hh'),
+    join_paths(meson.source_root(), 'src/libutil/sync.hh'),
+    join_paths(meson.source_root(), 'src/libutil/thread-pool.hh'),
+    join_paths(meson.source_root(), 'src/libutil/types.hh'),
+    join_paths(meson.source_root(), 'src/libutil/util.hh'),
+    join_paths(meson.source_root(), 'src/libutil/xml-writer.hh')
+)
+
+
+
+# dependancies
+#============================================================================
+
+libutil_dep_list = [
+    boost_dep,
+    libbz2_dep,
+    liblzma_dep,
+    libbrotli_dep,
+    openssl_dep,
+    pthread_dep,
+    libsodium_dep]
+
+
+
+
+# Link args
+#============================================================================
+
+libutil_link_list = []
+
+libutil_link_args = []
+
+
+
+
+# compiler args
+#============================================================================
+
+libutil_cxx_args = []
+
+
+
+
+# targets
+#============================================================================
+
+
+
+
+# build
+#============================================================================
+
+libutil_lib = library(
+    'nixutil',
+    install : true,
+    install_mode : 'rwxr-xr-x',
+    install_dir : libdir,
+    include_directories : src_inc,
+    sources : libutil_src,
+    link_args : libutil_link_args,
+    dependencies : libutil_dep_list)
+
+install_headers(
+    libutil_headers,
+    install_dir : join_paths(includedir, 'nix'))
diff --git a/third_party/nix/src/libutil/util.cc b/third_party/nix/src/libutil/util.cc
index ad8cc1894c14..05527473210d 100644
--- a/third_party/nix/src/libutil/util.cc
+++ b/third_party/nix/src/libutil/util.cc
@@ -33,7 +33,7 @@
 #endif
 
 
-extern char * * environ;
+extern char * * environ __attribute__((weak));
 
 
 namespace nix {
@@ -1179,7 +1179,7 @@ void _interrupted()
     /* Block user interrupts while an exception is being handled.
        Throwing an exception while another exception is being handled
        kills the program! */
-    if (!interruptThrown && !std::uncaught_exception()) {
+    if (!interruptThrown && !std::uncaught_exceptions()) {
         interruptThrown = true;
         throw Interrupted("interrupted by the user");
     }
diff --git a/third_party/nix/src/meson.build b/third_party/nix/src/meson.build
new file mode 100644
index 000000000000..9961b0938f74
--- /dev/null
+++ b/third_party/nix/src/meson.build
@@ -0,0 +1,48 @@
+# nix src build file
+#============================================================================
+
+src_dirs = [
+  'libutil',
+  'libstore',
+  'libmain',
+  'libexpr',
+  'nix',
+  'resolve-system-dependencies'
+]
+
+foreach dir : src_dirs
+    subdir(dir)
+endforeach
+
+
+
+libstore_config = pkg.generate(
+    libstore_lib,
+    libraries : [
+        libutil_lib],
+    version : meson.project_version(),
+    name : 'Nix',
+    subdirs : ['nix/'],
+    filebase : 'nix-store',
+    extra_cflags : '-std=c++17',
+    description : 'Nix Package Manager.')
+
+libmain_config = pkg.generate(
+    libmain_lib,
+    version : meson.project_version(),
+    name : 'Nix',
+    subdirs : ['nix/'],
+    filebase : 'nix-main',
+    extra_cflags : '-std=c++17',
+    description : 'Nix Package Manager.')
+
+libexpr_config = pkg.generate(
+    libexpr_lib,
+    libraries : [
+        libstore_lib],
+    version : meson.project_version(),
+    name : 'Nix',
+    subdirs : ['nix/'],
+    filebase : 'nix-expr',
+    extra_cflags : '-std=c++17',
+    description : 'Nix Package Manager.')
diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc
index 33ad28704a61..90b63d0ba5e4 100755
--- a/third_party/nix/src/nix-build/nix-build.cc
+++ b/third_party/nix/src/nix-build/nix-build.cc
@@ -21,7 +21,7 @@
 using namespace nix;
 using namespace std::string_literals;
 
-extern char * * environ;
+extern char * * environ __attribute__((weak));
 
 /* Recreate the effect of the perl shellwords function, breaking up a
  * string into arguments like a shell word, including escapes
diff --git a/third_party/nix/src/nix/main.cc b/third_party/nix/src/nix/main.cc
index c683d86df47b..bfc0a3def042 100644
--- a/third_party/nix/src/nix/main.cc
+++ b/third_party/nix/src/nix/main.cc
@@ -13,6 +13,9 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+
+#include <netinet/in.h>
+
 #include <ifaddrs.h>
 #include <netdb.h>
 #include <netinet/in.h>
diff --git a/third_party/nix/src/nix/meson.build b/third_party/nix/src/nix/meson.build
new file mode 100644
index 000000000000..be7ccb1a28a9
--- /dev/null
+++ b/third_party/nix/src/nix/meson.build
@@ -0,0 +1,152 @@
+# Nix exec build file
+#============================================================================
+
+
+
+
+# src files
+#============================================================================
+
+src_inc += include_directories('.')
+
+nix_src = files(
+    join_paths(meson.source_root(), 'src/nix/add-to-store.cc'),
+    join_paths(meson.source_root(), 'src/nix/build.cc'),
+    join_paths(meson.source_root(), 'src/nix/cat.cc'),
+    join_paths(meson.source_root(), 'src/nix/command.cc'),
+    join_paths(meson.source_root(), 'src/nix/copy.cc'),
+    join_paths(meson.source_root(), 'src/nix/doctor.cc'),
+    join_paths(meson.source_root(), 'src/nix/dump-path.cc'),
+    join_paths(meson.source_root(), 'src/nix/edit.cc'),
+    join_paths(meson.source_root(), 'src/nix/eval.cc'),
+    join_paths(meson.source_root(), 'src/nix/hash.cc'),
+    join_paths(meson.source_root(), 'src/nix/installables.cc'),
+    join_paths(meson.source_root(), 'src/nix/legacy.cc'),
+    join_paths(meson.source_root(), 'src/nix/log.cc'),
+    join_paths(meson.source_root(), 'src/nix/ls.cc'),
+    join_paths(meson.source_root(), 'src/nix/main.cc'),
+    join_paths(meson.source_root(), 'src/nix/optimise-store.cc'),
+    join_paths(meson.source_root(), 'src/nix/path-info.cc'),
+    join_paths(meson.source_root(), 'src/nix/ping-store.cc'),
+    join_paths(meson.source_root(), 'src/nix/progress-bar.cc'),
+    join_paths(meson.source_root(), 'src/nix/repl.cc'),
+    join_paths(meson.source_root(), 'src/nix/run.cc'),
+    join_paths(meson.source_root(), 'src/nix/search.cc'),
+    join_paths(meson.source_root(), 'src/nix/show-config.cc'),
+    join_paths(meson.source_root(), 'src/nix/show-derivation.cc'),
+    join_paths(meson.source_root(), 'src/nix/sigs.cc'),
+    join_paths(meson.source_root(), 'src/nix/upgrade-nix.cc'),
+    join_paths(meson.source_root(), 'src/nix/verify.cc'),
+    join_paths(meson.source_root(), 'src/nix/why-depends.cc'),
+
+    join_paths(meson.source_root(), 'src/build-remote/build-remote.cc'),
+    join_paths(meson.source_root(), 'src/nix-build/nix-build.cc'),
+    join_paths(meson.source_root(), 'src/nix-channel/nix-channel.cc'),
+    join_paths(meson.source_root(), 'src/nix-collect-garbage/nix-collect-garbage.cc'),
+    join_paths(meson.source_root(), 'src/nix-copy-closure/nix-copy-closure.cc'),
+    join_paths(meson.source_root(), 'src/nix-daemon/nix-daemon.cc'),
+    join_paths(meson.source_root(), 'src/nix-env/nix-env.cc'),
+    join_paths(meson.source_root(), 'src/nix-env/user-env.cc'),
+    join_paths(meson.source_root(), 'src/nix-instantiate/nix-instantiate.cc'),
+    join_paths(meson.source_root(), 'src/nix-prefetch-url/nix-prefetch-url.cc'),
+    join_paths(meson.source_root(), 'src/nix-store/dotgraph.cc'),
+    join_paths(meson.source_root(), 'src/nix-store/graphml.cc'),
+    join_paths(meson.source_root(), 'src/nix-store/nix-store.cc'))
+
+nix_ln_src = [
+    [ bindir, 'nix-build' ],
+    [ bindir, 'nix-channel' ],
+    [ bindir, 'nix-collect-garbage' ],
+    [ bindir, 'nix-copy-closure' ],
+    [ bindir, 'nix-daemon' ],
+    [ bindir, 'nix-env' ],
+    [ bindir, 'nix-hash' ],
+    [ bindir, 'nix-instantiate' ],
+    [ bindir, 'nix-prefetch-url' ],
+    [ bindir, 'nix-shell' ],
+    [ bindir, 'nix-store' ],
+    [ join_paths(libexecdir, 'nix'), 'build-remote' ]]
+
+nix_headers = files (
+    join_paths(meson.source_root(), 'src/nix/command.hh'),
+    join_paths(meson.source_root(), 'src/nix/legacy.hh'),
+    join_paths(meson.source_root(), 'src/nix/progress-bar.hh'),
+    join_paths(meson.source_root(), 'src/nix-env/user-env.hh'),
+    join_paths(meson.source_root(), 'src/nix-store/dotgraph.hh'),
+    join_paths(meson.source_root(), 'src/nix-store/graphml.hh'))
+
+# dependancies
+#============================================================================
+
+nix_dep_list = [
+    pthread_dep,
+    libdl_dep,
+    boost_dep,
+    editline_dep,
+    libsodium_dep]
+
+
+
+
+
+# Link args
+#============================================================================
+
+nix_link_list = [
+    libutil_lib,
+    libstore_lib,
+    libmain_lib,
+    libexpr_lib
+]
+
+nix_link_args = []
+
+
+
+
+# compiler args
+#============================================================================
+
+nix_cxx_args = []
+
+
+
+
+# targets
+#============================================================================
+
+
+
+
+# build
+#============================================================================
+
+nix_bin = executable(
+    'nix',
+    install : true,
+    install_mode : 'rwxr-xr-x',
+    install_dir : bindir,
+    include_directories : src_inc,
+    sources : nix_src,
+    link_with : nix_link_list,
+    dependencies : nix_dep_list)
+
+
+# meson does not yet support installing symlink files.
+# this is a simple workaround
+foreach name : nix_ln_src
+    meson.add_install_script(
+        'ln',
+        '-sf',
+        join_paths(bindir, 'nix'),
+        name[1])
+    meson.add_install_script(
+        'cp',
+        '-r',
+        name[1],
+        join_paths(name[0], name[1]))   
+endforeach
+
+install_headers(
+    nix_headers,
+    install_dir : join_paths(includedir, 'nix'))
diff --git a/third_party/nix/src/resolve-system-dependencies/meson.build b/third_party/nix/src/resolve-system-dependencies/meson.build
new file mode 100644
index 000000000000..afabed15e1e2
--- /dev/null
+++ b/third_party/nix/src/resolve-system-dependencies/meson.build
@@ -0,0 +1,58 @@
+# Nix exec build file
+#============================================================================
+
+
+
+
+# src files
+#============================================================================
+
+nix_src = files(
+    join_paths(meson.source_root(),
+    'src/resolve-system-dependencies/resolve-system-dependencies.cc'))
+
+
+
+# dependancies
+#============================================================================
+
+sys_deps_dep_list = []
+
+
+
+
+# Link args
+#============================================================================
+
+sys_deps_link_args = []
+
+
+
+
+# compiler args
+#============================================================================
+
+sys_deps_cxx_args = []
+
+
+
+
+# targets
+#============================================================================
+
+
+
+
+# build
+#============================================================================
+
+if sys_name == 'darwin'
+    sys_deps_bin = executable(
+        'resolve-system-dependencies',
+        install : true,
+        install_dir : bindir,
+        include_directories : src_inc,
+        sources : nix_src,
+        link_args : sys_deps_link_args,
+        dependencies : sys_deps_dep_list)
+endif
\ No newline at end of file