Skip to content

Commit

Permalink
And more instructions to setup Nix
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Nov 9, 2023
1 parent 79b1c09 commit c0099e3
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,37 @@ Install the [Nix package manager](https://nixos.org/download).
sh <(curl -L https://nixos.org/nix/install)
```

And to bring the environment up use:
And enable some Nix flags (alternatively you can add `--extra-experimental-features 'nix-command flakes'` every time calling the `nix` command):
```bash
nix --extra-experimental-features 'nix-command flakes' develop
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
```

The `extra-experimental-features` can set globally by adding the following to `~/.config/nix/nix.conf` or `/etc/nix/nix.conf`:
```
experimental-features = nix-command flakes
And to bring the environment up, just open a new shell terminal, go to the root folder of the repo and run:
```bash
nix develop
```

One can also use the [`direnv`](https://direnv.net/) (installation via Nix can be found [here](https://github.com/nix-community/nix-direnv#installation)) to automatically load the environment when entering the main folder or using a plugin in your preferred IDE:
This will download all dev deps and setup the environment accordingly.

You can also use the [`direnv`](https://direnv.net/) to automatically load the environment when entering the main folder or using a plugin in your preferred IDE:
- `vscode`: [mkhl.direnv](https://github.com/direnv/direnv-vscode)
- `jet brains`: [Direnv integration](https://plugins.jetbrains.com/plugin/15285-direnv-integration)

Direnv can also be easily installed with Nix (or [HomeBrew](https://formulae.brew.sh/formula/direnv) if you prefer):
```bash
nix-env -f '<nixpkgs>' -iA direnv
```

Now you just to add the direnv hook to your shell:
```bash
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
# or for ZSH
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
```

Now next time you open a new shell terminal and go to repo's folder you environment will update and load automatically.

Dev Dependencies (Manual install)
----------------

Expand Down

0 comments on commit c0099e3

Please sign in to comment.