Skip to content

Commit 2f0f935

Browse files
committed
don't overwrite existing stack.yaml or default.nix
1 parent 5087b65 commit 2f0f935

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

haskell-emacs.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,22 +403,24 @@ executable HaskellEmacs
403403
(call-process "cabal" nil heB nil "install")))
404404
(if (eq tool 'stack)
405405
(progn (setq haskell-emacs--bin (concat "~/.local/bin/HaskellEmacs" (when (eq system-type 'windows-nt) ".exe")))
406-
(with-temp-buffer
407-
(insert "
406+
(unless (file-exists-p (concat haskell-emacs-dir "stack.yaml"))
407+
(with-temp-buffer
408+
(insert "
408409
resolver: lts-6.6
409410
packages:
410411
- '.'
411412
extra-deps: [ atto-lisp-0.2.2.2 ]")
412-
(write-file (concat haskell-emacs-dir "stack.yaml")))
413+
(write-file (concat haskell-emacs-dir "stack.yaml"))))
413414
(message "Compiling ...")
414415
(+ (call-process "stack" nil heB nil "setup")
415416
(call-process "stack" nil heB nil "install")))
416417
(if (eq tool 'nix)
417418
(progn (setq haskell-emacs--bin (concat haskell-emacs-dir "result/bin/HaskellEmacs"))
418-
(with-temp-buffer (insert "
419+
(unless (file-exists-p (concat haskell-emacs-dir "default.nix"))
420+
(with-temp-buffer (insert "
419421
{ nixpkgs ? import <nixpkgs> {} }:
420422
nixpkgs.pkgs.haskellPackages.callPackage ./HaskellEmacs.nix { }")
421-
(write-file (concat haskell-emacs-dir "default.nix")))
423+
(write-file (concat haskell-emacs-dir "default.nix"))))
422424
(message "Compiling ...")
423425
(+ (call-process "nix-shell" nil heB nil "-p" "--pure" "cabal2nix" "--command" "cabal2nix . > HaskellEmacs.nix")
424426
(call-process "nix-build" nil heB nil))))))))

0 commit comments

Comments
 (0)