From ffa5b851f2da25aece74067578c6c165924ec5d2 Mon Sep 17 00:00:00 2001 From: thattemperature <2719023332@qq.com> Date: Fri, 18 Jul 2025 00:55:18 +0800 Subject: [PATCH] emacsPackages.eaf: init at 0-unstable-2025-08-01 --- .../emacs/elisp-packages/manual-packages.nix | 4 + .../manual-packages/eaf/package.nix | 17 +++ .../emacs-application-framework/default.nix | 134 ++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 pkgs/applications/editors/emacs/elisp-packages/manual-packages/eaf/package.nix create mode 100644 pkgs/applications/editors/emacs/elisp-packages/manual-packages/emacs-application-framework/default.nix diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix index 1b06e1596c5a..948a730d0c6f 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix @@ -17,6 +17,10 @@ lib.packagesFromDirectoryRecursive { elpaca = callPackage ./manual-packages/elpaca { inherit (pkgs) git; }; + emacs-application-framework = callPackage ./manual-packages/emacs-application-framework { + inherit (pkgs) git; + }; + lsp-bridge = callPackage ./manual-packages/lsp-bridge { inherit (pkgs) basedpyright diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/eaf/package.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/eaf/package.nix new file mode 100644 index 000000000000..b17c357a504d --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/eaf/package.nix @@ -0,0 +1,17 @@ +{ + emacs-application-framework, +}: + +let + + withApplications = + enabledApps: + emacs-application-framework.override { + inherit enabledApps; + }; + +in + +{ + inherit withApplications; +} diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/emacs-application-framework/default.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/emacs-application-framework/default.nix new file mode 100644 index 000000000000..28c27c569c13 --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/emacs-application-framework/default.nix @@ -0,0 +1,134 @@ +{ + # Basic + lib, + melpaBuild, + fetchFromGitHub, + symlinkJoin, + # Python dependency + python3, + # Emacs dependencies + all-the-icons, + # Other dependencies + git, + nodejs, + wmctrl, + xdotool, + # Updater + unstableGitUpdater, + # Sub-applications in the framework + enabledApps ? [ ], +}: + +let + + appPythonDeps = builtins.map (item: item.eafPythonDeps) enabledApps; + appOtherDeps = builtins.map (item: item.eafOtherDeps) enabledApps; + + pythonPackageLists = [ + ( + ps: with ps; [ + epc + lxml + pyqt6 + pyqt6-sip + pyqt6-webengine + sexpdata + tld + ] + ) + ] + ++ appPythonDeps; + pythonPkgs = ps: builtins.concatLists (builtins.map (f: f ps) pythonPackageLists); + pythonEnv = python3.withPackages pythonPkgs; + + otherPackageLists = [ + [ + git + nodejs + wmctrl + xdotool + ] + ] + ++ appOtherDeps; + otherPkgs = builtins.concatLists (otherPackageLists); + + appsDrv = symlinkJoin { + name = "emacs-application-framework-apps"; + paths = enabledApps; + }; + depsBin = symlinkJoin { + name = "emacs-application-framework-deps-bin"; + paths = otherPkgs; + }; + +in + +melpaBuild (finalAttrs: { + + pname = "eaf"; + version = "0-unstable-2025-08-01"; + + src = fetchFromGitHub { + owner = "emacs-eaf"; + repo = "emacs-application-framework"; + rev = "f7431199fb3143f4487213b7ea6a16a3d037b2ff"; + hash = "sha256-qpaLizkxuOKd/9kfym3+xAssVm+sV3IlxLCApv+yUz8="; + }; + + packageRequires = [ + all-the-icons + ]; + + postPatch = '' + substituteInPlace eaf.el \ + --replace-fail "\"python.exe\" \"python3\"" \ + "\"python.exe\" \"${pythonEnv.interpreter}\"" + ''; + + files = '' + ("*.el" + "*.py" + "applications.json" + "core" + "extension") + ''; + + preInstall = '' + EMACSLOADPATH="$EMACSLOADPATH:core/" + ''; + + postInstall = '' + LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion} + APPLISPDIR=${appsDrv}/share/emacs/site-lisp/elpa + if [ -d $APPLISPDIR ]; then + cp -r $APPLISPDIR/. \ + $LISPDIR/app/ + fi + + NATDIR=$out/share/emacs/native-lisp + APPNATDIR=${appsDrv}/share/emacs/native-lisp + if [ -d $APPNATDIR ]; then + cp -r $APPNATDIR/. \ + $NATDIR/ + fi + + mkdir -p $out/bin/ + for item in ${depsBin}/bin/*; do + # Some symbolic links point to another symbolic link + ln -s $(readlink -f $item) \ + $out/bin/$(basename $item) + done + ''; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Extensible framework of Emacs"; + homepage = "https://github.com/emacs-eaf/emacs-application-framework"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ + thattemperature + ]; + }; + +})