2016-09-17 57 views
1

我正在嘗試使用Nix和Stack爲wxHaskell設置構建環境。如何與nix一起使用堆棧來構建wxHaskell項目?

我已經通過nix安裝了wxWidgets-3.0.2。這是由.cabal文件

executable hellowx-exe 
hs-source-dirs:  app 
main-is:   Main.hs 
ghc-options:  -threaded -rtsopts -with-rtsopts=-N 
build-depends:  base 
        , hellowx 
        , wx 
        , wxc 
        , wxcore 
        , wxdirect 

相關部分和stack.yaml文件

resolver: lts-5.0 
extra-deps: 
- wx-0.92.2.0 
- wxc-0.92.2.0 
- wxcore-0.92.2.0 
- wxdirect-0.92.2.0 

加入

nix: 
    enable: true 
    packages: [wxwidgets] 

我試過,但,這不是明顯的正確途徑。

因此,我擺脫了.yaml文件中的nix部分,並嘗試導致失敗的命令$ stack --nix build。日誌文件說

[1 of 1] Compiling Main    (/run/user/1000/stack8847/wxc-0.92.2.0/Setup.hs, /run/user/1000/stack8847/wxc-0.92.2.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.22.5.0/setup/Main.o) 
Linking /run/user/1000/stack8847/wxc-0.92.2.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.22.5.0/setup/setup ... 
Error: wx-config not found, please install wx-config before installing wxc 

但是我確實有通過nix安裝的wx-config和wxwidgets。構建過程出於某種原因無法找到它。我能做些什麼來設置這個構建環境?有沒有辦法指示構建過程來查看包含wx-config的目錄?我無法弄清楚它爲什麼找不到它。它在PATH中。

回答

1

好吧,我想通了。我添加了錯誤的「屬性名稱」。這是正確的stack.yaml文件

# at this point in time nix supports lts-5.0 
resolver: lts-5.0 

packages: 
-'.' 

extra-deps: 
- wx-0.92.2.0 
- wxc-0.92.2.0 
- wxcore-0.92.2.0 
- wxdirect-0.92.2.0 

# wxwidgets-3.0.2 has the attribute name wxGTK30 
# you also need zlib, mesa_noglu and x11 

nix: 
    enable: true 
    packages: [zlib, wxGTK30, mesa_noglu, x11] 

這似乎正確地構建一切,我能夠在這裏建立一個最小的窗口(minimal.hs

+0

爲什麼你不使用shell.nix? – CMCDragonkai

相關問題