Skip to content

Commit

Permalink
docs: update nix env
Browse files Browse the repository at this point in the history
  • Loading branch information
hadelive committed Feb 17, 2024
1 parent e4ab1e6 commit a64c8c6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx'
themeConfig: './theme.config.jsx',
defaultShowCopyCode: true,
readingTime: true,
})

module.exports = {
Expand Down
1 change: 1 addition & 0 deletions pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"index": "Production Grade Dapps",
"nix_environments": "Nix Environments",
"bridge_template": "Bridge Template",
"linear_vesting": "Linear Vesting",
"plutarch_merkle_tree": "Plutarch Merkle Tree",
Expand Down
42 changes: 42 additions & 0 deletions pages/nix_environments.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Nix environments

Before you begin, ensure you have [Nix](https://nixos.org/download.html) installed on your system. Nix is used for package management and to provide a consistent development environment.
To install run the following command:

```sh
sh <(curl -L https://nixos.org/nix/install) --daemon
```

and follow the instructions.

```sh
$ nix --version
nix (Nix) 2.18.1
```

Make sure to enable [Nix Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes) by editing either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` on
your machine and add the following configuration entries:

```yaml
experimental-features = nix-command flakes ca-derivations
allow-import-from-derivation = true
```

Optionally, to improve build speed, it is possible to set up binary caches
maintained by IOHK and Plutonomicon by setting additional configuration entries:

```yaml
substituters = https://cache.nixos.org https://iohk.cachix.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo=
```

To facilitate seamlessly moving between directories and associated Nix development shells we use [direnv](https://direnv.net) and [nix-direnv](https://github.com/nix-community/nix-direnv):

Your shell and editors should pick up on the `.envrc` files in different directories and prepare the environment accordingly. Use `direnv allow` to enable the direnv environment and `direnv reload` to reload it when necessary. Otherwise, the `.envrc` file contains a proper Nix target you can use with the `nix develop` command.

To install both using `nixpkgs`:

```sh
nix profile install nixpkgs#direnv
nix profile install nixpkgs#nix-direnv
```

0 comments on commit a64c8c6

Please sign in to comment.