Extend haskell-build-type to look for .nix files
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia in haskell-customize.el, all'altezza di haskell-build-type, e verifica in che modo i suoi controlli per cabal, stack ed eseguibili determinano il tipo di build. Confronta questo rilevamento con haskell-process-wrapper-function e con la configurazione di flake.nix o shell.nix descritta qui. Il lavoro è completato quando un progetto Haskell basato su Nix può essere riconosciuto senza strumenti installati globalmente e il rilevamento esistente continua a funzionare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is not a bug but a missed edge case, the problem is:
- I run nixos and use nix for haskell projects
- because of (1) I do not have cabal, stack or ghc globally installed
- So I have
flake.nixandshell.nixand friends in root directories of project.
Now the traditional way to run inferior-haskell-process is with haskell-process-wrapper like so (this uses the nix-sandbox emacs package):
(setq default-nix-wrapper
(lambda (args)
(append
(append (list "nix-shell" "--command")
(list (mapconcat 'identity args " ")))
(list (nix-current-sandbox))))
(setq haskell-process-wrapper-function
(lambda (args)
(apply 'nix-shell-command (nix-current-sandbox) args)))
However, this doesn't work because haskell-build-type in haskell-customize.el looks for a cabal cabal.project stack file and an executable on path:
(defun haskell-build-type ()
"Looks for cabal and stack spec files.
When found, returns a pair (TAG . DIR)
where TAG is 'cabal-project, 'cabal-sandbox. 'cabal, or 'stack;
and DIR is the directory containing cabal or stack file.
When none found, DIR is nil, and TAG is 'ghc"
;; REVIEW maybe just 'cabal is enough.
(let ((cabal-project (locate-dominating-file default-directory "cabal.project"))
(cabal-sandbox (locate-dominating-file default-directory "cabal.sandbox.config"))
(stack (locate-dominating-file default-directory "stack.yaml"))
(cabal (locate-dominating-file
default-directory
(lambda (d)
(cl-find-if
(lambda (f) (string-match-p ".\\.cabal\\'" f))
(directory-files d))))))
(cond
((and cabal-project (executable-find "cabal"))
(cons 'cabal-project cabal-project))
((and cabal-sandbox (executable-find "cabal"))
(cons 'cabal-sandbox cabal-sandbox))
((and stack (executable-find "stack"))
(cons 'stack stack))
((and cabal (executable-find "cabal")) ;; <---------------------------------------------- right here
(cons 'cabal cabal))
((executable-find "ghc") (cons 'ghc nil))
(t (error "Could not find any installation of GHC.")))))
This means that when I try run-haskell or haskell-process-load-file I get Could not find any installation of GHC even though ghc cabal and friends are accessible from my nix shell.
So to summarize:
- the current implementation of
haskell-build-typeassumes I havestackorcabalglobally installed. - However, the user could not have these globally installed and instead choose to provide them in a nix shell. In this scenario
haskell-build-typedoes not realize this and prematurely errors out, even though if it ran inside the nix shell everything would be fine.
So I think there are two paths forward:
- add
.nixfiles to thecondexpression inhaskell-build-type, or - detect if
haskell-process-wrapper-function is set, if so runexecutable-find "foo"` through that.
I think 2 likely makes more sense.
- Lingua principale
- Emacs Lisp
- Stelle
- 1.4k
- Fork
- 357
- Merge medio
- 7h 50m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di haskell/haskell-mode
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
haskell/haskell-mode#1889 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
haskell/haskell-mode#1522 ·
-
haskell-indentation: identifier named `signature` breaks indentation for the rest of the declarationForse già presa @PerryLink l’ha presa 48 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
haskell/haskell-mode#1895 ·
-
.hsc/CPP Can't find headers.Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
haskell/haskell-mode#1892 ·
-
Need help with haskell-modeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
haskell/haskell-mode#1890 ·
Tutte le issue di haskell/haskell-mode
Issue simili
-
area: middleware enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rohitgollarahalli/mcpx#45 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
facebookresearch/atlas-lean#20218 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100