aboutsummaryrefslogtreecommitdiff
path: root/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'package.nix')
-rw-r--r--package.nix73
1 files changed, 37 insertions, 36 deletions
diff --git a/package.nix b/package.nix
index b9ef0273c..62927e569 100644
--- a/package.nix
+++ b/package.nix
@@ -36,7 +36,7 @@
meson,
ninja,
openssl,
- pegtl ? __forDefaults.pegtl,
+ pegtl,
pkg-config,
python3,
rapidcheck,
@@ -53,16 +53,24 @@
pname ? "lix",
versionSuffix ? "",
- officialRelease ? false,
+ officialRelease ? __forDefaults.versionJson.official_release,
# Set to true to build the release notes for the next release.
buildUnreleasedNotes ? true,
internalApiDocs ? false,
+ # List of Meson sanitize options. Accepts values of b_sanitize, e.g.
+ # "address", "undefined", "thread".
+ sanitize ? null,
+ # Turn compiler warnings into errors.
+ werror ? false,
+
# Not a real argument, just the only way to approximate let-binding some
# stuff for argument defaults.
__forDefaults ? {
canRunInstalled = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+ versionJson = builtins.fromJSON (builtins.readFile ./version.json);
+
boehmgc-nix = boehmgc.override { enableLargeConfig = true; };
editline-lix = editline.overrideAttrs (prev: {
@@ -71,8 +79,6 @@
lix-doc = callPackage ./lix-doc/package.nix { };
build-release-notes = callPackage ./maintainers/build-release-notes.nix { };
-
- pegtl = callPackage ./misc/pegtl.nix { };
},
}:
let
@@ -80,8 +86,7 @@ let
inherit (lib) fileset;
inherit (stdenv) hostPlatform buildPlatform;
- versionJson = builtins.fromJSON (builtins.readFile ./version.json);
- version = versionJson.version + versionSuffix;
+ version = __forDefaults.versionJson.version + versionSuffix;
aws-sdk-cpp-nix = aws-sdk-cpp.override {
apis = [
@@ -93,31 +98,19 @@ let
# Reimplementation of Nixpkgs' Meson cross file, with some additions to make
# it actually work.
- mesonCrossFile =
- let
- cpuFamily =
- platform:
- with platform;
- if isAarch32 then
- "arm"
- else if isx86_32 then
- "x86"
- else
- platform.uname.processor;
- in
- builtins.toFile "lix-cross-file.conf" ''
- [properties]
- # Meson is convinced that if !buildPlatform.canExecute hostPlatform then we cannot
- # build anything at all, which is not at all correct. If we can't execute the host
- # platform, we'll just disable tests and doc gen.
- needs_exe_wrapper = false
-
- [binaries]
- # Meson refuses to consider any CMake binary during cross compilation if it's
- # not explicitly specified here, in the cross file.
- # https://github.com/mesonbuild/meson/blob/0ed78cf6fa6d87c0738f67ae43525e661b50a8a2/mesonbuild/cmake/executor.py#L72
- cmake = 'cmake'
- '';
+ mesonCrossFile = builtins.toFile "lix-cross-file.conf" ''
+ [properties]
+ # Meson is convinced that if !buildPlatform.canExecute hostPlatform then we cannot
+ # build anything at all, which is not at all correct. If we can't execute the host
+ # platform, we'll just disable tests and doc gen.
+ needs_exe_wrapper = false
+
+ [binaries]
+ # Meson refuses to consider any CMake binary during cross compilation if it's
+ # not explicitly specified here, in the cross file.
+ # https://github.com/mesonbuild/meson/blob/0ed78cf6fa6d87c0738f67ae43525e661b50a8a2/mesonbuild/cmake/executor.py#L72
+ cmake = 'cmake'
+ '';
# The internal API docs need these for the build, but if we're not building
# Nix itself, then these don't need to be propagated.
@@ -181,6 +174,12 @@ stdenv.mkDerivation (finalAttrs: {
dontBuild = false;
mesonFlags =
+ let
+ sanitizeOpts = lib.optionals (sanitize != null) (
+ [ "-Db_sanitize=${builtins.concatStringsSep "," sanitize}" ]
+ ++ lib.optional (builtins.elem "address" sanitize) "-Dgc=disabled"
+ );
+ in
lib.optionals hostPlatform.isLinux [
# You'd think meson could just find this in PATH, but busybox is in buildInputs,
# which don't actually get added to PATH. And buildInputs is correct over
@@ -196,8 +195,10 @@ stdenv.mkDerivation (finalAttrs: {
(lib.mesonEnable "internal-api-docs" internalApiDocs)
(lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck)
(lib.mesonBool "enable-docs" canRunInstalled)
+ (lib.mesonBool "werror" werror)
]
- ++ lib.optional (hostPlatform != buildPlatform) "--cross-file=${mesonCrossFile}";
+ ++ lib.optional (hostPlatform != buildPlatform) "--cross-file=${mesonCrossFile}"
+ ++ sanitizeOpts;
# We only include CMake so that Meson can locate toml11, which only ships CMake dependency metadata.
dontUseCmakeConfigure = true;
@@ -384,8 +385,6 @@ stdenv.mkDerivation (finalAttrs: {
pegtl
;
- inherit officialRelease;
-
# The collection of dependency logic for this derivation is complicated enough that
# it's easier to parameterize the devShell off an already called package.nix.
mkDevShell =
@@ -399,13 +398,14 @@ stdenv.mkDerivation (finalAttrs: {
glibcLocales,
just,
llvmPackages,
- nixfmt,
+ nixfmt-rfc-style,
skopeo,
xonsh,
# Lix specific packages
pre-commit-checks,
contribNotice,
+ check-syscalls,
}:
let
glibcFix = lib.optionalAttrs (buildPlatform.isLinux && glibcLocales != null) {
@@ -456,11 +456,12 @@ stdenv.mkDerivation (finalAttrs: {
# `bash` from inside `nix develop`, say, because you are using it
# via direnv, you will by default get bash (unusable edition).
bashInteractive
+ check-syscalls
pythonEnv
# docker image tool
skopeo
just
- nixfmt
+ nixfmt-rfc-style
# Included above when internalApiDocs is true, but we set that to
# false intentionally to save dev build time.
# To build them in a dev shell, you can set -Dinternal-api-docs=enabled when configuring.