Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aycanirican/nixit
Build my haskell project using nix
https://github.com/aycanirican/nixit
cabal cabal2nix haskell hpack nix stack
Last synced: 18 days ago
JSON representation
Build my haskell project using nix
- Host: GitHub
- URL: https://github.com/aycanirican/nixit
- Owner: aycanirican
- License: mit
- Created: 2019-06-27T05:47:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-01T06:53:57.000Z (about 5 years ago)
- Last Synced: 2024-11-19T04:00:27.360Z (3 months ago)
- Topics: cabal, cabal2nix, haskell, hpack, nix, stack
- Language: Nix
- Size: 9.77 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nixit
Build my haskell executable using nix.
## Usage
- You are in your project's directory
```
cd $TMP
mkdir project1; cd project1
```
- You have a proper `Main.hs` file like this:
```
module Main where
main :: IO ()
main = print "5 more minutes...Done."
```
- Optionally you write all haskell dependencies (one for each line)
in a file `.nixit.deps` like:
```
aeson
servant-client
lens
```
Then you can have your executable with:
```
nix build -f https://github.com/aycanirican/nixit/archive/master.tar.gz \
--arg src "$PWD" \
--argstr deps "$(cat .nixit.deps | xargs)"
```And also you can have a ghci session with:
```
nix-shell -p "pkgs.haskellPackages.ghcWithPackages (p: with p; [ $(cat .nixit.deps | xargs) ])" \
--command "ghci Main.hs"
```Or if you want to just execute ghcid and watch it recompiling your project:
```
nix-shell -p "pkgs.haskellPackages.ghcWithPackages (p: with p; [ $(cat .nixit.deps | xargs) ])" \
-p haskellPackages.ghcid \
--command "ghcid --command \"ghci Main.hs\""
```Or you may want to stick on a release:
```
NIX_PATH=nixpkgs=https://nixos.org/channels/nixos-19.09/nixexprs.tar.xz \
nix-shell -p "pkgs.haskellPackages.ghcWithPackages (p: with p; [ $(cat .nixit.deps | xargs) ])" --command "ghci Main.hs"
```