aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcmd/meson.build1
-rw-r--r--src/libexpr/meson.build1
-rw-r--r--src/libfetchers/meson.build1
-rw-r--r--src/libmain/meson.build1
-rw-r--r--src/libstore/build/local-derivation-goal.cc8
-rw-r--r--src/libstore/meson.build1
-rw-r--r--src/libutil/args.cc2
-rw-r--r--src/libutil/args.hh7
-rw-r--r--src/libutil/args/root.hh4
-rw-r--r--src/libutil/meson.build1
-rw-r--r--src/nix/meson.build1
-rw-r--r--src/pch/precompiled-headers.hh60
12 files changed, 85 insertions, 3 deletions
diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build
index 4da1b496b..4dc0714c8 100644
--- a/src/libcmd/meson.build
+++ b/src/libcmd/meson.build
@@ -54,6 +54,7 @@ libcmd = library(
nlohmann_json,
lix_doc
],
+ cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build
index fda6fde2c..9a18c7ab3 100644
--- a/src/libexpr/meson.build
+++ b/src/libexpr/meson.build
@@ -145,6 +145,7 @@ libexpr = library(
include_directories : [
'../libmain',
],
+ cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build
index dbb85b84c..365bcd4a7 100644
--- a/src/libfetchers/meson.build
+++ b/src/libfetchers/meson.build
@@ -30,6 +30,7 @@ libfetchers = library(
liblixutil,
nlohmann_json,
],
+ cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libmain/meson.build b/src/libmain/meson.build
index b17247a9d..075aa83b2 100644
--- a/src/libmain/meson.build
+++ b/src/libmain/meson.build
@@ -20,6 +20,7 @@ libmain = library(
liblixutil,
liblixstore,
],
+ cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 99468d420..7066f5c93 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -1847,8 +1847,12 @@ void LocalDerivationGoal::runChild()
copyFile(path, chrootRootDir + path, { .followSymlinks = true });
}
- if (settings.caFile != "")
- pathsInChroot.try_emplace("/etc/ssl/certs/ca-certificates.crt", settings.caFile, true);
+ if (settings.caFile != "" && pathExists(settings.caFile)) {
+ // For the same reasons as above, copy the CA certificates file too.
+ // It should be even less likely to change during the build than resolv.conf.
+ createDirs(chrootRootDir + "/etc/ssl/certs");
+ copyFile(settings.caFile, chrootRootDir + "/etc/ssl/certs/ca-certificates.crt", { .followSymlinks = true });
+ }
}
for (auto & i : ss) pathsInChroot.emplace(i, i);
diff --git a/src/libstore/meson.build b/src/libstore/meson.build
index f776e9621..65ecacc20 100644
--- a/src/libstore/meson.build
+++ b/src/libstore/meson.build
@@ -220,6 +220,7 @@ libstore = library(
nlohmann_json,
],
cpp_args : cpp_args,
+ cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 655b3e82f..1342e7c6a 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -64,7 +64,7 @@ RootArgs & Args::getRoot()
while (p->parent)
p = p->parent;
- auto * res = dynamic_cast<RootArgs *>(p);
+ auto res = p->asRootArgs();
assert(res);
return *res;
}
diff --git a/src/libutil/args.hh b/src/libutil/args.hh
index 35a5238c0..71f8f88fa 100644
--- a/src/libutil/args.hh
+++ b/src/libutil/args.hh
@@ -244,6 +244,13 @@ protected:
*/
virtual void initialFlagsProcessed() {}
+ /**
+ * Returns this Args as a RootArgs if it is one, or \ref std::nullopt otherwise.
+ */
+ virtual std::optional<std::reference_wrapper<RootArgs>> asRootArgs() {
+ return std::nullopt;
+ }
+
public:
void addFlag(Flag && flag);
diff --git a/src/libutil/args/root.hh b/src/libutil/args/root.hh
index f8124eaff..499ee6df4 100644
--- a/src/libutil/args/root.hh
+++ b/src/libutil/args/root.hh
@@ -65,6 +65,10 @@ protected:
*/
std::set<ExperimentalFeature> flagExperimentalFeatures;
+ virtual std::optional<std::reference_wrapper<RootArgs>> asRootArgs() override {
+ return *this;
+ }
+
private:
std::optional<std::string> needsCompletion(std::string_view s);
diff --git a/src/libutil/meson.build b/src/libutil/meson.build
index 96450fbe2..cfdd0e52c 100644
--- a/src/libutil/meson.build
+++ b/src/libutil/meson.build
@@ -129,6 +129,7 @@ libutil = library(
openssl,
nlohmann_json,
],
+ cpp_pch : ['../pch/precompiled-headers.hh'],
implicit_include_directories : true,
install : true,
)
diff --git a/src/nix/meson.build b/src/nix/meson.build
index e41399b5d..45303641f 100644
--- a/src/nix/meson.build
+++ b/src/nix/meson.build
@@ -89,6 +89,7 @@ nix = executable(
boehm,
nlohmann_json,
],
+ cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/pch/precompiled-headers.hh b/src/pch/precompiled-headers.hh
new file mode 100644
index 000000000..f52f1cab8
--- /dev/null
+++ b/src/pch/precompiled-headers.hh
@@ -0,0 +1,60 @@
+#include <algorithm>
+#include <array>
+#include <atomic>
+#include <cassert>
+#include <cctype>
+#include <chrono>
+#include <climits>
+#include <cmath>
+#include <condition_variable>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <exception>
+#include <functional>
+#include <future>
+#include <iostream>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <numeric>
+#include <optional>
+#include <queue>
+#include <random>
+#include <regex>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <string>
+#include <thread>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include <boost/format.hpp>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <signal.h>
+#include <sys/resource.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/utsname.h>
+#include <sys/wait.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include <nlohmann/json.hpp>