diff options
author | Qyriad <qyriad@qyriad.me> | 2024-08-10 10:59:58 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-08-20 17:21:13 +0000 |
commit | 95863b258bde3ec11d9688e35454e523571ac17d (patch) | |
tree | 1a2c1a973988a371c20bc315e01709fbac96d8d3 /package.nix | |
parent | f1533160aaa0b2ecd0bb26d6445808593ecb0726 (diff) |
build: build lix-doc with Meson! 🎉
lix-doc is now built with Meson, with lix-doc's dependencies built as
Meson subprojects, either fetched on demand with .wrap files, or fetched
in advance by Nix with importCargoLock. It even builds statically.
Fixes #256.
Co-authored-by: Lunaphied <lunaphied@lunaphied.me>
Co-authored-by: Jade Lovelace <lix@jade.fyi>
Change-Id: I3a4731ff13278e7117e0316bc0d7169e85f5eb0c
Diffstat (limited to 'package.nix')
-rw-r--r-- | package.nix | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/package.nix b/package.nix index 295e9139f..af542cdf5 100644 --- a/package.nix +++ b/package.nix @@ -41,6 +41,8 @@ pkg-config, python3, rapidcheck, + rustPlatform, + rustc, sqlite, toml11, util-linuxMinimal ? utillinuxMinimal, @@ -49,9 +51,6 @@ busybox-sandbox-shell, - # internal fork of nix-doc providing :doc in the repl - lix-doc ? __forDefaults.lix-doc, - pname ? "lix", versionSuffix ? "", officialRelease ? __forDefaults.versionJson.official_release, @@ -83,7 +82,6 @@ configureFlags = prev.configureFlags or [ ] ++ [ (lib.enableFeature true "sigstop") ]; }); - lix-doc = callPackage ./lix-doc/package.nix { }; build-release-notes = callPackage ./maintainers/build-release-notes.nix { }; }, }: @@ -137,6 +135,7 @@ let ./meson.build ./meson.options ./meson + ./lix-doc ./scripts/meson.build ./subprojects ]); @@ -219,6 +218,7 @@ stdenv.mkDerivation (finalAttrs: { meson ninja cmake + rustc ] ++ [ (lib.getBin lowdown) @@ -258,7 +258,6 @@ stdenv.mkDerivation (finalAttrs: { lowdown libsodium toml11 - lix-doc pegtl ] ++ lib.optionals hostPlatform.isLinux [ @@ -290,6 +289,8 @@ stdenv.mkDerivation (finalAttrs: { BOOST_LIBRARYDIR = "${lib.getLib boost}/lib"; }; + cargoDeps = rustPlatform.importCargoLock { lockFile = ./lix-doc/Cargo.lock; }; + preConfigure = lib.optionalString (!finalAttrs.dontBuild && !hostPlatform.isStatic) '' # Copy libboost_context so we don't get all of Boost in our closure. @@ -311,6 +312,17 @@ stdenv.mkDerivation (finalAttrs: { install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib '' + '' + # Copy the Cargo dependencies to where Meson expects them to be, so we + # can seamlessly use Meson's subproject wraps, but just do the download + # ahead of time. Luckily for us, importCargoLock-downloaded crates use + # the exact naming scheme Meson expects! + # The directory from importCargoLock does contain a lockfile, which we + # don't need, but all the crate directories start with a word character, + # then have a hyphen, and then a sequence of digits or periods for the + # version. + find "$cargoDeps" -type l -regex '.*/\w.+-[0-9.]+$' -exec \ + ln -sv "{}" "$PWD/subprojects/" ";" + # Fix up /usr/bin/env shebangs relied on by the build patchShebangs --build tests/ doc/manual/ ''; |