diff --git a/flake.nix b/flake.nix index 5d34f894..d28e71d9 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; }; @@ -7,8 +7,9 @@ let system = "x86_64-linux"; 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 -- # Nix's `sha256 =` attr accepts hex directly). subprojects = { @@ -68,40 +69,88 @@ # Build the shell commands that stage each subproject's source (and, # if present, unzip its wrapdb "patch" overlay on top) into # subprojects/, exactly like `meson subprojects download` would. - stageSubprojects = pkgs.lib.concatStrings (pkgs.lib.mapAttrsToList + stageSubprojects = lib.concatStrings (lib.mapAttrsToList (name: sp: '' mkdir -p "subprojects/${sp.dir}" 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}" ''} '') subprojects); in { - packages.${system}.default = pkgs.stdenv.mkDerivation { - name = "myproject"; - src = self; + packages.${system}.default = + with pkgs; + stdenv.mkDerivation { + name = "mu4e"; + src = self; - nativeBuildInputs = with pkgs; [ - pkg-config - meson - ninja - unzip - python3 - ]; + nativeBuildInputs = [ + pkg-config + meson + ninja + texinfo + emacs + python3 + cmake + cld2 + unzip + ]; - buildInputs = [ ]; + buildInputs = [ glib gmime3 xapian ]; - postPatch = stageSubprojects + '' - # Scripts vendored via fetchurl (e.g. CLI11's scripts/ExtractVersion.py) - # keep their original #!/usr/bin/env python3 shebang, which doesn't - # resolve inside the Nix build sandbox. patchShebangs rewrites them - # to point at the python3 in nativeBuildInputs. - patchShebangs subprojects - ''; + postPatch = stageSubprojects + '' + # Scripts vendored via fetchurl (e.g. CLI11's scripts/ExtractVersion.py) + # keep their original #!/usr/bin/env python3 shebang, which doesn't + # resolve inside the Nix build sandbox. patchShebangs rewrites them + # to point at the python3 in nativeBuildInputs. + patchShebangs subprojects + ''; - mesonFlags = [ - "--wrap-mode=nodownload" - ]; - }; + mesonFlags = [ + # "--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"; + }; + }; }; }