properly handle subprojects
Some checks are pending
Build & run tests / build (macos-latest) (push) Waiting to run
Build & run tests / build (ubuntu-latest) (push) Waiting to run

This commit is contained in:
2026-08-20 15:03:12 -07:00
parent 1c7c2cf9a0
commit 241a5ea06a

View File

@ -1,5 +1,5 @@
{ {
description = "project with vendored meson subprojects"; description = "mu and mu4e email package for emacs";
inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; }; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; };
@ -7,8 +7,9 @@
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
# One entry per .wrap file. `hash`/`patchHash` are the # One entry per .wrap file. `sha256`/patch `sha256` are the
# source_hash/patch_hash values from the .wrap, as-is (hex sha256 -- # source_hash/patch_hash values from the .wrap, as-is (hex sha256 --
# Nix's `sha256 =` attr accepts hex directly). # Nix's `sha256 =` attr accepts hex directly).
subprojects = { subprojects = {
@ -68,28 +69,34 @@
# Build the shell commands that stage each subproject's source (and, # Build the shell commands that stage each subproject's source (and,
# if present, unzip its wrapdb "patch" overlay on top) into # if present, unzip its wrapdb "patch" overlay on top) into
# subprojects/<dir>, exactly like `meson subprojects download` would. # subprojects/<dir>, exactly like `meson subprojects download` would.
stageSubprojects = pkgs.lib.concatStrings (pkgs.lib.mapAttrsToList stageSubprojects = lib.concatStrings (lib.mapAttrsToList
(name: sp: '' (name: sp: ''
mkdir -p "subprojects/${sp.dir}" mkdir -p "subprojects/${sp.dir}"
tar xf ${sp.src} -C subprojects --strip-components=0 tar xf ${sp.src} -C subprojects --strip-components=0
${pkgs.lib.optionalString (sp ? patch) '' ${lib.optionalString (sp ? patch) ''
unzip -o -q ${sp.patch} -d "subprojects/${sp.dir}" unzip -o -q ${sp.patch} -d "subprojects/${sp.dir}"
''} ''}
'') subprojects); '') subprojects);
in { in {
packages.${system}.default = pkgs.stdenv.mkDerivation { packages.${system}.default =
name = "myproject"; with pkgs;
stdenv.mkDerivation {
name = "mu4e";
src = self; src = self;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = [
pkg-config pkg-config
meson meson
ninja ninja
unzip texinfo
emacs
python3 python3
cmake
cld2
unzip
]; ];
buildInputs = [ ]; buildInputs = [ glib gmime3 xapian ];
postPatch = stageSubprojects + '' postPatch = stageSubprojects + ''
# Scripts vendored via fetchurl (e.g. CLI11's scripts/ExtractVersion.py) # Scripts vendored via fetchurl (e.g. CLI11's scripts/ExtractVersion.py)
@ -100,8 +107,50 @@
''; '';
mesonFlags = [ mesonFlags = [
"--wrap-mode=nodownload" # "--debug"
"-Dscm=disabled"
"-Dreadline=disabled"
"-Demacs=${emacs}/bin/emacs"
# CLI11's own meson.build pulls in a catch2 subproject for its
# test suite. We only consume CLI11 as a library, so disable its
# tests option to avoid needing to vendor catch2 as well.
"-Dcli11:tests=disabled"
]; ];
# preConfigure = ''
# echo "=== DEBUG: Environment before meson configure ==="
# echo "PWD: $(pwd)"
# echo "Python version:"
# python3 --version || echo "python3 not available"
# echo "Python path:"
# #which python3 || echo "python3 not in PATH"
# echo "PATH: $PATH"
# echo "Meson version:"
# meson --version
# echo "Available files in current directory:"
# ls -la
# echo "Checking for Python scripts:"
# find . -name "*.py" -type f | head -10
# echo "=============================================="
# '';
meta = with lib; {
description = "Email indexer and Emacs client (mu4e)";
longDescription = ''
mu is a tool for dealing with email messages stored in the
Maildir-format. mu's purpose in life is to help you to quickly find the
messages you need; in addition, it allows you to view messages, extract
attachments, create new maildirs, and so on.
mu4e is an Emacs-based e-mail client that uses mu as its back-end.
'';
license = licenses.gpl3Plus;
homepage = "https://www.djcbsoftware.nl/code/mu/";
changelog = "https://github.com/djcb/mu/blob/v${version}/NEWS.org";
maintainers = with maintainers; [ antono chvp peterhoeg ];
platforms = platforms.unix;
mainProgram = "mu";
};
}; };
}; };
} }