78
78
:group 'haskell-interactive
79
79
:type '(choice string (repeat string)))
80
80
81
+ (defcustom haskell-process-path-nix-shell
82
+ " nix-shell"
83
+ " The path for starting nix-shell."
84
+ :group 'haskell-interactive
85
+ :type '(choice string (repeat string)))
86
+
87
+ (defcustom haskell-process-args-nix-shell
88
+ '(" nix/devel.nix" )
89
+ " The path for starting nix-shell."
90
+ :group 'haskell-interactive
91
+ :type '(choice string (repeat string)))
92
+
93
+
81
94
(defcustom haskell-process-args-ghci
82
95
'(" -ferror-spans" )
83
96
" Any arguments for starting ghci."
@@ -106,7 +119,8 @@ See `haskell-process-do-cabal' for more details."
106
119
(defcustom haskell-process-type
107
120
'ghci
108
121
" The inferior Haskell process type to use."
109
- :type '(choice (const ghci) (const cabal-repl) (const cabal-dev) (const cabal-ghci))
122
+ :type '(choice (const ghci) (const cabal-repl) (const cabal-dev)
123
+ (const cabal-ghci) (const nix-shell-ghci))
110
124
:group 'haskell-interactive )
111
125
112
126
(defcustom haskell-process-log
@@ -504,7 +518,8 @@ for various things, but is optional."
504
518
" Add <cabal-project-dir>/dist/build/autogen/ to the ghci search
505
519
path. This allows modules such as 'Path_...', generated by cabal,
506
520
to be loaded by ghci."
507
- (unless (eq 'cabal-repl haskell-process-type) ; ; redundant with "cabal repl"
521
+ (unless (or (eq 'cabal-repl haskell-process-type) ; ; redundant with "cabal repl"
522
+ (eq 'nix-shell-ghci haskell-process-type))
508
523
(let*
509
524
((session (haskell-session ))
510
525
(cabal-dir (haskell-session-cabal-dir session))
@@ -527,13 +542,20 @@ to be loaded by ghci."
527
542
(cadr state)
528
543
(format haskell-process-do-cabal-format-string
529
544
(haskell-session-cabal-dir (car state))
530
- (format " %s %s "
545
+ (format " %s %s %s "
531
546
(ecase haskell-process-type
532
547
('ghci haskell-process-path-cabal)
533
548
('cabal-repl haskell-process-path-cabal)
534
549
('cabal-ghci haskell-process-path-cabal)
535
- ('cabal-dev haskell-process-path-cabal-dev))
536
- (caddr state)))))
550
+ ('cabal-dev haskell-process-path-cabal-dev)
551
+ ('nix-shell-ghci (concat haskell-process-path-nix-shell
552
+ " "
553
+ haskell-process-args-nix-shell
554
+ " --command '" )))
555
+ (caddr state)
556
+ (case haskell-process-type
557
+ ('nix-shell-ghci " '" )
558
+ (t " " ))))))
537
559
538
560
:live
539
561
(lambda (state buffer )
@@ -575,7 +597,8 @@ to be loaded by ghci."
575
597
('ghci haskell-process-path-cabal)
576
598
('cabal-repl haskell-process-path-cabal)
577
599
('cabal-ghci haskell-process-path-cabal)
578
- ('cabal-dev haskell-process-path-cabal-dev))
600
+ ('cabal-dev haskell-process-path-cabal-dev)
601
+ ('nix-shell-ghci haskell-process-path-nix-shell))
579
602
:app-icon haskell-process-logo
580
603
)))))))))
581
604
@@ -1050,7 +1073,25 @@ now."
1050
1073
haskell-process-path-cabal-dev
1051
1074
" ghci"
1052
1075
" -s"
1053
- dir))))))
1076
+ dir)))
1077
+ ('nix-shell-ghci
1078
+ (haskell-process-log
1079
+ (propertize
1080
+ (format " Starting inferior nix-shell (ghci) process using %s %s %s %s ... "
1081
+ haskell-process-path-nix-shell
1082
+ haskell-process-args-nix-shell
1083
+ " --command"
1084
+ haskell-process-path-ghci)
1085
+ 'face font-lock-comment-face ))
1086
+ (apply #'start-process
1087
+ (append (list (haskell-session-name session)
1088
+ nil
1089
+ haskell-process-path-nix-shell)
1090
+ haskell-process-args-nix-shell
1091
+ '(" --command" )
1092
+ (list haskell-process-path-ghci)
1093
+ (let ((target (haskell-session-target session)))
1094
+ (if target (list target) nil ))))))))
1054
1095
(progn (set-process-sentinel (haskell-process-process process) 'haskell-process-sentinel )
1055
1096
(set-process-filter (haskell-process-process process) 'haskell-process-filter ))
1056
1097
(haskell-process-send-startup process)
0 commit comments