Skip to content

Commit

Permalink
Fix #1558: add flake template for nix flake init
Browse files Browse the repository at this point in the history
This depends on NixOS/templates#40

This issue makes both `nix run haskell-nix#hix -- init` and
`nix flake init --template haskell-nix#template --impure` do the same
thing!
  • Loading branch information
yvan-sraka committed Aug 8, 2022
1 parent ba13d45 commit cf9213e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/tutorials/getting-started-flakes.md
Expand Up @@ -12,6 +12,37 @@ project and its dependencies into Nix code.
Assuming you have [Nix](https://nixos.org/download.html) installed, you can
start setting up your project.

## Using `flake init` and `nix`

The `flake init` command create an example `hello` package from hackage
containing an `flake.nix` and `nix/hix.nix` file. The project can be used with
regular `nix` tools.

```bash
nix flake init --template haskell-nix#template --impure
# `--impure` is required by `builtins.currentSystem`
nix develop
cabal build
```

To view the contents of the flake run:

```
nix flake show
```

To build a component with nix:

```
nix build .#hello:exe:hello
```

To build and run a component:

```
nix run .#hello:exe:hello
```

## Setting up the binary cache

IMPORTANT: you *must* do this or you *will* build several copies of GHC!
Expand Down

0 comments on commit cf9213e

Please sign in to comment.