aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build14
-rw-r--r--meson.options4
-rw-r--r--package.nix11
-rw-r--r--src/libcmd/meson.build2
-rw-r--r--src/libexpr/meson.build2
-rw-r--r--src/libfetchers/meson.build2
-rw-r--r--src/libmain/meson.build2
-rw-r--r--src/libstore/meson.build2
-rw-r--r--src/libutil/meson.build2
-rw-r--r--src/nix/meson.build2
-rw-r--r--tests/functional/common/vars-and-functions.sh.in3
-rw-r--r--tests/nixos/nix-copy.nix3
-rw-r--r--tests/unit/meson.build12
13 files changed, 43 insertions, 18 deletions
diff --git a/meson.build b/meson.build
index 51c7bda59..4a42b7a73 100644
--- a/meson.build
+++ b/meson.build
@@ -129,6 +129,20 @@ endif
cxx = meson.get_compiler('cpp')
+
+# clangd breaks when GCC is using precompiled headers lmao
+# https://git.lix.systems/lix-project/lix/issues/374
+should_pch = get_option('enable-pch-std')
+summary('PCH C++ stdlib', should_pch, bool_yn : true)
+if should_pch
+ # Unlike basically everything else that takes a file, Meson requires the arguments to
+ # cpp_pch : to be strings and doesn't accept files(). So absolute path it is.
+ cpp_pch = [meson.project_source_root() / 'src/pch/precompiled-headers.hh']
+else
+ cpp_pch = []
+endif
+
+
# Translate some historical and Mesony CPU names to Lixy CPU names.
# FIXME(Qyriad): the 32-bit x86 code is not tested right now, because cross compilation for Lix
# to those architectures is currently broken for other reasons, namely:
diff --git a/meson.options b/meson.options
index 6b13fa8a0..fc2050809 100644
--- a/meson.options
+++ b/meson.options
@@ -64,3 +64,7 @@ option('internal-api-docs', type : 'feature', value : 'auto',
option('profile-dir', type : 'string', value : 'etc/profile.d',
description : 'the path to install shell profile files',
)
+
+option('enable-pch-std', type : 'boolean', value : true,
+ description : 'whether to use precompiled headers for C++\'s standard library (breaks clangd if you\'re using GCC)',
+)
diff --git a/package.nix b/package.nix
index 6c0201c7f..c9e8ece3f 100644
--- a/package.nix
+++ b/package.nix
@@ -442,9 +442,14 @@ stdenv.mkDerivation (finalAttrs: {
# For Meson to find Boost.
env = finalAttrs.env;
- # I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom,
- # which only propagates stuff set in hooks? idk.
- inherit (finalAttrs) mesonFlags;
+ mesonFlags =
+ # I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom,
+ # which only propagates stuff set in hooks? idk.
+ finalAttrs.mesonFlags
+ # Clangd breaks when GCC is using precompiled headers, so for the devshell specifically
+ # we make precompiled C++ stdlib conditional on using Clang.
+ # https://git.lix.systems/lix-project/lix/issues/374
+ ++ [ (lib.mesonBool "enable-pch-std" stdenv.cc.isClang) ];
packages =
lib.optional (stdenv.cc.isClang && hostPlatform == buildPlatform) clang-tools_llvm
diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build
index 4dc0714c8..3d92f36a4 100644
--- a/src/libcmd/meson.build
+++ b/src/libcmd/meson.build
@@ -54,7 +54,7 @@ libcmd = library(
nlohmann_json,
lix_doc
],
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build
index e60a85b5d..080fdb443 100644
--- a/src/libexpr/meson.build
+++ b/src/libexpr/meson.build
@@ -145,7 +145,7 @@ libexpr = library(
include_directories : [
'../libmain',
],
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build
index ee38b6cda..b66d0b9f9 100644
--- a/src/libfetchers/meson.build
+++ b/src/libfetchers/meson.build
@@ -30,7 +30,7 @@ libfetchers = library(
liblixutil,
nlohmann_json,
],
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libmain/meson.build b/src/libmain/meson.build
index 075aa83b2..a7cce287c 100644
--- a/src/libmain/meson.build
+++ b/src/libmain/meson.build
@@ -20,7 +20,7 @@ libmain = library(
liblixutil,
liblixstore,
],
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libstore/meson.build b/src/libstore/meson.build
index 7a129d22c..fa363bd19 100644
--- a/src/libstore/meson.build
+++ b/src/libstore/meson.build
@@ -220,7 +220,7 @@ libstore = library(
nlohmann_json,
],
cpp_args : cpp_args,
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/src/libutil/meson.build b/src/libutil/meson.build
index 8c3377e76..f6d14a11b 100644
--- a/src/libutil/meson.build
+++ b/src/libutil/meson.build
@@ -129,7 +129,7 @@ libutil = library(
openssl,
nlohmann_json,
],
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
implicit_include_directories : true,
install : true,
)
diff --git a/src/nix/meson.build b/src/nix/meson.build
index 8115a3d08..22f148fcb 100644
--- a/src/nix/meson.build
+++ b/src/nix/meson.build
@@ -89,7 +89,7 @@ nix = executable(
boehm,
nlohmann_json,
],
- cpp_pch : ['../pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,
diff --git a/tests/functional/common/vars-and-functions.sh.in b/tests/functional/common/vars-and-functions.sh.in
index 3b343b720..bd1990973 100644
--- a/tests/functional/common/vars-and-functions.sh.in
+++ b/tests/functional/common/vars-and-functions.sh.in
@@ -146,7 +146,8 @@ fi
isDaemonNewer () {
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
local requiredVersion="$1"
- local daemonVersion=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version | cut -d' ' -f3)
+ local versionOutput=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version)
+ local daemonVersion=${versionOutput##* }
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]]
}
diff --git a/tests/nixos/nix-copy.nix b/tests/nixos/nix-copy.nix
index 3bcc7a988..44aa0b7da 100644
--- a/tests/nixos/nix-copy.nix
+++ b/tests/nixos/nix-copy.nix
@@ -37,7 +37,8 @@ in {
{ config, pkgs, ... }:
{ services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
- users.users.root.password = "foobar";
+ users.users.root.hashedPasswordFile = lib.mkForce null;
+ users.users.root.password = "foobar";
virtualisation.writableStore = true;
virtualisation.additionalPaths = [ pkgB pkgC ];
};
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index 06aff4626..0d3f00ba5 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -68,7 +68,7 @@ libutil_tester = executable(
liblixutil_test_support,
nlohmann_json,
],
- cpp_pch : ['../../src/pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
)
test(
@@ -103,7 +103,7 @@ libstore_test_support = library(
include_directories : include_directories(
'libstore-support',
),
- cpp_pch : ['../../src/pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
)
liblixstore_test_support = declare_dependency(
include_directories : include_directories('libstore-support'),
@@ -137,7 +137,7 @@ libstore_tester = executable(
gtest,
nlohmann_json,
],
- cpp_pch : ['../../src/pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
)
test(
@@ -169,7 +169,7 @@ libexpr_test_support = library(
include_directories : include_directories(
'libexpr-support',
),
- cpp_pch : ['../../src/pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
)
liblixexpr_test_support = declare_dependency(
include_directories : include_directories('libexpr-support'),
@@ -203,7 +203,7 @@ libexpr_tester = executable(
gtest,
nlohmann_json,
],
- cpp_pch : ['../../src/pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
)
test(
@@ -230,7 +230,7 @@ libcmd_tester = executable(
gtest,
boost,
],
- cpp_pch : ['../../src/pch/precompiled-headers.hh'],
+ cpp_pch : cpp_pch,
)
test(