Purescript development tools

This commit is contained in:
Andrea Ciceri 2021-11-03 23:28:49 +01:00 committed by Andrea Ciceri
parent 4d356b3a06
commit 4e8adcfafb
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
7 changed files with 104 additions and 32 deletions

View file

@ -16,7 +16,6 @@ emacsWithPackages (
evil-collection evil-collection
fira-code-mode fira-code-mode
haskell-mode haskell-mode
notmuch
helm helm
helm-ag helm-ag
helm-company helm-company
@ -27,11 +26,15 @@ emacsWithPackages (
lsp-python-ms lsp-python-ms
magit magit
nix-mode nix-mode
notmuch
org-download org-download
org-fragtog org-fragtog
org-roam org-roam
org-superstar org-superstar
projectile projectile
psc-ide
psci
purescript-mode
rainbow-delimiters rainbow-delimiters
rainbow-identifiers rainbow-identifiers
sudo-utils sudo-utils

View file

@ -2,6 +2,7 @@
{ {
home-manager.users.ccr = { suites, ... }: { home-manager.users.ccr = { suites, ... }: {
imports = with suites; shell ++ gui ++ browser ++ multimedia ++ emails ++ dev ++ base; imports = with suites; shell ++ gui ++ browser ++ multimedia ++ emails ++ dev ++ base;
home.packages = with pkgs; [ home.packages = with pkgs; [
ack ack
ranger ranger
@ -15,10 +16,6 @@
yarn yarn
yarn2nix yarn2nix
texlive.combined.scheme-full texlive.combined.scheme-full
purescript
spago
nodePackages.parcel-bundler
nodejs
]; ];
}; };

View file

@ -17,7 +17,20 @@
DICPATH = "${pkgs.hunspellDicts.it_IT}/share/hunspell:${pkgs.hunspellDicts.en_US}/share/hunspell"; DICPATH = "${pkgs.hunspellDicts.it_IT}/share/hunspell:${pkgs.hunspellDicts.en_US}/share/hunspell";
} else { }; } else { };
home.packages = with pkgs; [ home.packages =
let
easy-ps = import
(pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "easy-purescript-nix";
rev = "7802db65618c2ead3a55121355816b4c41d276d9";
sha256 = "0n99hxxcp9yc8yvx7bx4ac6askinfark7dnps3hzz5v9skrvq15q";
})
{
inherit pkgs;
};
in
with pkgs; [
python3Full python3Full
fd fd
ag ag
@ -39,5 +52,15 @@
mimeType = "x-scheme-handler/org-protocol"; mimeType = "x-scheme-handler/org-protocol";
} }
) )
] ++ (if pkgs.system == "x86_64-linux" then [ python-language-server ] else [ ]); ] ++ (if pkgs.system == "x86_64-linux" then [
python-language-server
] ++ (with easy-ps; [
purs
spago
spago2nix
pulp
purescript-language-server
purs-tidy
nodejs
]) else [ ]);
} }

View file

@ -1,7 +1,8 @@
(use-package evil (use-package evil
:init :custom
(setq evil-want-keybinding nil) (evil-want-keybinding nil)
(evil-undo-system 'undo-redo)
:config :config
(evil-mode 1) ; globally enable evil-mode except for the following modes (evil-mode 1) ; globally enable evil-mode except for the following modes
(mapcar (lambda (mode) (evil-set-initial-state mode 'emacs)) (mapcar (lambda (mode) (evil-set-initial-state mode 'emacs))

View file

@ -15,4 +15,4 @@
(global-set-key [f6] 'nixos-rebuild-test) (global-set-key [f6] 'nixos-rebuild-test)
(provide 'nix) (provide 'config-nix)

View file

@ -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)

View file

@ -24,6 +24,7 @@ Return nil if COMMAND is not found anywhere in `exec-path'."
(require 'config-lsp) (require 'config-lsp)
(require 'config-python) (require 'config-python)
(require 'config-spelling) (require 'config-spelling)
(require 'nix) (require 'config-nix)
(require 'config-purescript)
(server-start) (server-start)