From 8b3fb0123c93e7745df7c288e37a7ce77b8d3fb7 Mon Sep 17 00:00:00 2001 From: Emmet Date: Fri, 19 May 2023 20:25:57 -0500 Subject: [PATCH] Added emacs eaf to my flake! --- flake.lock | 34 ++++++++++++++++++++++++++++ flake.nix | 12 +++++++++- user/app/doom-emacs/config.el | 28 +++++++++++++++++++++++ user/app/doom-emacs/doom.nix | 29 +++++++++++++++++++++++- user/app/doom-emacs/doom.org | 7 ++---- user/home.nix | 2 +- user/lang/python/python-packages.nix | 2 +- user/lang/python/python.nix | 2 +- 8 files changed, 106 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 49611da..a375469 100644 --- a/flake.lock +++ b/flake.lock @@ -54,6 +54,38 @@ "type": "github" } }, + "eaf": { + "flake": false, + "locked": { + "lastModified": 1684236422, + "narHash": "sha256-csmx8X/06rzFXcsUrH79Ha1V7SmdztiMEzQ75DW0CYo=", + "owner": "emacs-eaf", + "repo": "emacs-application-framework", + "rev": "6a9fa4cc6ce2878b9585f5a5a34f6b0b9693fe6f", + "type": "github" + }, + "original": { + "owner": "emacs-eaf", + "repo": "emacs-application-framework", + "type": "github" + } + }, + "eaf-browser": { + "flake": false, + "locked": { + "lastModified": 1683381393, + "narHash": "sha256-eZnSFyhN6/C/jV1+oaKOu3hunetJPNPFhzsnEkz7pYA=", + "owner": "emacs-eaf", + "repo": "eaf-browser", + "rev": "0edb767209255732099cd38967e2fb0f0eefd314", + "type": "github" + }, + "original": { + "owner": "emacs-eaf", + "repo": "eaf-browser", + "type": "github" + } + }, "emacs-overlay": { "flake": false, "locked": { @@ -495,6 +527,8 @@ }, "root": { "inputs": { + "eaf": "eaf", + "eaf-browser": "eaf-browser", "home-manager": "home-manager", "nix-doom-emacs": "nix-doom-emacs", "nixpkgs": "nixpkgs_2", diff --git a/flake.nix b/flake.nix index bbc8127..e8d1f2b 100644 --- a/flake.nix +++ b/flake.nix @@ -7,9 +7,17 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; nix-doom-emacs.url = "github:nix-community/nix-doom-emacs"; stylix.url = "github:danth/stylix"; + eaf = { + url = "github:emacs-eaf/emacs-application-framework"; + flake = false; + }; + eaf-browser = { + url = "github:emacs-eaf/eaf-browser"; + flake = false; + }; }; - outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, ... }: + outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, ... }@inputs: let system = "x86_64-linux"; name = "emmet"; @@ -41,6 +49,8 @@ myNixConfigurationFilePath = dotfilesDir+"/system/configuration.nix"; myHomeManagerFilePath = dotfilesDir+"/user/home.nix"; myTheme = theme; + inherit (inputs) eaf; + inherit (inputs) eaf-browser; }; }; }; diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index a1929eb..1cebfd2 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -935,3 +935,31 @@ https://github.com/magit/magit/issues/460 (@cpitclaudel)." (add-to-list 'focus-mode-to-thing '(lisp-mode . paragraph)) ;(add-hook 'org-mode-hook #'focus-mode) + +;;;-- Load emacs application framework;;;-- +(use-package! eaf + :load-path "~/.emacs.d/eaf/" + :init + :custom + (eaf-browser-continue-where-left-off t) + (eaf-browser-enable-adblocker t) + (browse-url-browser-function 'eaf-open-browser) ;; Make EAF Browser my default browser + :config + (defalias 'browse-web #'eaf-open-browser) + + (require 'eaf-browser) + + (require 'eaf-evil) + (define-key key-translation-map (kbd "SPC") + (lambda (prompt) + (if (derived-mode-p 'eaf-mode) + (pcase eaf--buffer-app-name + ("browser" (if (string= (eaf-call-sync "eval_function" eaf--buffer-id "is_focus") "True") + (kbd "SPC") + (kbd eaf-evil-leader-key))) + (_ (kbd "SPC"))) + (kbd "SPC"))))) + +(map! :leader + :desc "Open web browser" + "o w" #'eaf-open-browser-with-history) diff --git a/user/app/doom-emacs/doom.nix b/user/app/doom-emacs/doom.nix index 11b3163..02e413b 100644 --- a/user/app/doom-emacs/doom.nix +++ b/user/app/doom-emacs/doom.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, eaf, eaf-browser, ... }: { programs.doom-emacs = { @@ -9,4 +9,31 @@ template = builtins.readFile ./themes/doom-stylix-theme.el.mustache; extension = ".el"; }; + home.packages = with pkgs; [ + git + nodejs + wmctrl + jshon + aria + (python3.withPackages (p: with p; [ + pandas + requests + pyqt6 sip qtpy qt6.qtwebengine epc lxml pyqt6-webengine + pysocks + pymupdf + markdown + ]))]; + home.file.".emacs.d/eaf" = { + source = "${eaf}"; + recursive = true; + }; + home.file.".emacs.d/eaf/app/browser" = { + source = "${eaf-browser}"; + recursive = true; + onChange = " + pushd ~/.emacs.d/eaf/app/browser; + npm install darkreader @mozilla/readability; + popd; + "; + }; } diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index cdbbdf1..a9b3bf0 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -1303,10 +1303,10 @@ I don't have this active right now since I'm exploring tab-bar mode instead! #+END_SRC ** EAF -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle config.el ;;;-- Load emacs application framework;;;-- (use-package! eaf - :load-path "~/.local/bin/emacs-application-framework/" + :load-path "~/.emacs.d/eaf/" :init :custom (eaf-browser-continue-where-left-off t) @@ -1315,7 +1315,6 @@ I don't have this active right now since I'm exploring tab-bar mode instead! :config (defalias 'browse-web #'eaf-open-browser) - (require 'eaf-pdf-viewer) (require 'eaf-browser) (require 'eaf-evil) @@ -1326,8 +1325,6 @@ I don't have this active right now since I'm exploring tab-bar mode instead! ("browser" (if (string= (eaf-call-sync "eval_function" eaf--buffer-id "is_focus") "True") (kbd "SPC") (kbd eaf-evil-leader-key))) - ("pdf-viewer" (kbd eaf-evil-leader-key)) - ("image-viewer" (kbd eaf-evil-leader-key)) (_ (kbd "SPC"))) (kbd "SPC"))))) diff --git a/user/home.nix b/user/home.nix index a05dd62..b91c465 100644 --- a/user/home.nix +++ b/user/home.nix @@ -19,7 +19,7 @@ ./app/games/games.nix # Various videogame apps ./style/stylix.nix # Styling and themes for my apps ./lang/cc/cc.nix # C and C++ tools - ./lang/python/python.nix # Python + #./lang/python/python.nix # Python #./lang/python/python-packages.nix # Extra Python packages I want ./lang/haskell/haskell.nix # Haskell tools #./lang/android/android.nix # Android developement diff --git a/user/lang/python/python-packages.nix b/user/lang/python/python-packages.nix index bd314d0..f1c03db 100644 --- a/user/lang/python/python-packages.nix +++ b/user/lang/python/python-packages.nix @@ -2,7 +2,7 @@ { # Python packages - home.packages = with pkgs.python310Packages; [ + home.packages = with pkgs.python3Packages; [ cffi dbus-python wheel diff --git a/user/lang/python/python.nix b/user/lang/python/python.nix index d6ee2ee..67b4ca3 100644 --- a/user/lang/python/python.nix +++ b/user/lang/python/python.nix @@ -3,7 +3,7 @@ { home.packages = with pkgs; [ # Python setup - python310Full + python3Full imath pystring ];