diff --git a/pkgs/emacs/default.nix b/pkgs/emacs/default.nix index 64fa007..5390a0d 100644 --- a/pkgs/emacs/default.nix +++ b/pkgs/emacs/default.nix @@ -16,7 +16,6 @@ emacsWithPackages ( evil-collection fira-code-mode haskell-mode - notmuch helm helm-ag helm-company @@ -27,11 +26,15 @@ emacsWithPackages ( lsp-python-ms magit nix-mode + notmuch org-download org-fragtog org-roam org-superstar projectile + psc-ide + psci + purescript-mode rainbow-delimiters rainbow-identifiers sudo-utils diff --git a/users/ccr/default.nix b/users/ccr/default.nix index f9486ae..9f3f6d2 100644 --- a/users/ccr/default.nix +++ b/users/ccr/default.nix @@ -2,6 +2,7 @@ { home-manager.users.ccr = { suites, ... }: { imports = with suites; shell ++ gui ++ browser ++ multimedia ++ emails ++ dev ++ base; + home.packages = with pkgs; [ ack ranger @@ -15,10 +16,6 @@ yarn yarn2nix texlive.combined.scheme-full - purescript - spago - nodePackages.parcel-bundler - nodejs ]; }; diff --git a/users/profiles/emacs/default.nix b/users/profiles/emacs/default.nix index 455d0a7..5b0ba5d 100644 --- a/users/profiles/emacs/default.nix +++ b/users/profiles/emacs/default.nix @@ -17,27 +17,50 @@ DICPATH = "${pkgs.hunspellDicts.it_IT}/share/hunspell:${pkgs.hunspellDicts.en_US}/share/hunspell"; } else { }; - home.packages = with pkgs; [ - python3Full - fd - ag - nixpkgs-fmt - rnix-lsp - haskell-language-server - stylish-haskell - graphviz-nox - hunspell - hunspellDicts.en_US - hunspellDicts.it_IT - ( - makeDesktopItem { - name = "org-protocol"; - exec = "emacsclient %u"; - comment = "Org protocol"; - desktopName = "org-protocol"; - type = "Application"; - mimeType = "x-scheme-handler/org-protocol"; - } - ) - ] ++ (if pkgs.system == "x86_64-linux" then [ python-language-server ] else [ ]); + home.packages = + let + easy-ps = import + (pkgs.fetchFromGitHub { + owner = "justinwoo"; + repo = "easy-purescript-nix"; + rev = "7802db65618c2ead3a55121355816b4c41d276d9"; + sha256 = "0n99hxxcp9yc8yvx7bx4ac6askinfark7dnps3hzz5v9skrvq15q"; + }) + { + inherit pkgs; + }; + in + with pkgs; [ + python3Full + fd + ag + nixpkgs-fmt + rnix-lsp + haskell-language-server + stylish-haskell + graphviz-nox + hunspell + hunspellDicts.en_US + hunspellDicts.it_IT + ( + makeDesktopItem { + name = "org-protocol"; + exec = "emacsclient %u"; + comment = "Org protocol"; + desktopName = "org-protocol"; + type = "Application"; + mimeType = "x-scheme-handler/org-protocol"; + } + ) + ] ++ (if pkgs.system == "x86_64-linux" then [ + python-language-server + ] ++ (with easy-ps; [ + purs + spago + spago2nix + pulp + purescript-language-server + purs-tidy + nodejs + ]) else [ ]); } diff --git a/users/profiles/emacs/emacs.d/config/config-evil.el b/users/profiles/emacs/emacs.d/config/config-evil.el index a310051..8797f2f 100644 --- a/users/profiles/emacs/emacs.d/config/config-evil.el +++ b/users/profiles/emacs/emacs.d/config/config-evil.el @@ -1,7 +1,8 @@ (use-package evil - :init - (setq evil-want-keybinding nil) + :custom + (evil-want-keybinding nil) + (evil-undo-system 'undo-redo) :config (evil-mode 1) ; globally enable evil-mode except for the following modes (mapcar (lambda (mode) (evil-set-initial-state mode 'emacs)) diff --git a/users/profiles/emacs/emacs.d/config/nix.el b/users/profiles/emacs/emacs.d/config/config-nix.el similarity index 95% rename from users/profiles/emacs/emacs.d/config/nix.el rename to users/profiles/emacs/emacs.d/config/config-nix.el index 4f6d444..8fea505 100644 --- a/users/profiles/emacs/emacs.d/config/nix.el +++ b/users/profiles/emacs/emacs.d/config/config-nix.el @@ -15,4 +15,4 @@ (global-set-key [f6] 'nixos-rebuild-test) -(provide 'nix) +(provide 'config-nix) diff --git a/users/profiles/emacs/emacs.d/config/config-purescript.el b/users/profiles/emacs/emacs.d/config/config-purescript.el new file mode 100644 index 0000000..310c9ad --- /dev/null +++ b/users/profiles/emacs/emacs.d/config/config-purescript.el @@ -0,0 +1,47 @@ +(use-package psc-ide + :custom + (psc-ide-rebuild-on-save t) + + :config + ;; The following is stolen from the Spacemacs purescript layer + + (defun purescript-purs-tidy-format-buffer () + "Format buffer with purs-tidy." + (interactive) + (if (executable-find "purs-tidy") + (let* ((extension (file-name-extension (or buffer-file-name "tmp.purs") t)) + (tmpfile (make-temp-file "~fmt-tmp" nil extension)) + (coding-system-for-read 'utf-8) + (coding-system-for-write 'utf-8) + (outputbuf (get-buffer-create "*~fmt-tmp.purs*"))) + (unwind-protect + (progn + (with-current-buffer outputbuf (erase-buffer)) + (write-region nil nil tmpfile) + (if (zerop (apply #'call-process-region nil nil "purs-tidy" nil + `(,outputbuf ,tmpfile) nil + `("format"))) + (let ((p (point))) + (save-excursion + (with-current-buffer (current-buffer) + (replace-buffer-contents outputbuf))) + (goto-char p) + (message "formatted.") + (kill-buffer outputbuf)) + (message "Formatting failed!") + (display-buffer outputbuf))) + (delete-file tmpfile))) + (error "purs-tidy not found"))) + + :hook + (before-save . purescript-purs-tidy-format-buffer) + (purescript-mode . (lambda () + (psc-ide-mode) + (company-mode) + (flycheck-mode) + (turn-on-purescript-indentation) + ))) + +(use-package psci) + +(provide 'config-purescript) diff --git a/users/profiles/emacs/emacs.d/init.el b/users/profiles/emacs/emacs.d/init.el index 0d36d65..290eef7 100644 --- a/users/profiles/emacs/emacs.d/init.el +++ b/users/profiles/emacs/emacs.d/init.el @@ -24,6 +24,7 @@ Return nil if COMMAND is not found anywhere in `exec-path'." (require 'config-lsp) (require 'config-python) (require 'config-spelling) -(require 'nix) +(require 'config-nix) +(require 'config-purescript) (server-start)