|
3 | 3 | ## Requirements |
4 | 4 |
|
5 | 5 | - Install [Nix](https://nixos.org/download.html) |
6 | | -- Enable Flakes [permanently](https://nixos.wiki/wiki/Flakes#Permanent) |
| 6 | +- Enable [Flakes](https://nixos.wiki/wiki/Flakes#Permanent) permanently |
| 7 | +- Install [devenv](https://devenv.sh/getting-started/): |
7 | 8 |
|
8 | | -**For macOS users** |
| 9 | +## Project Structure |
9 | 10 |
|
10 | | -Add the following lines to configuration file located at `/etc/nix/nix.conf`: |
| 11 | +The project uses: |
| 12 | +- Nix Flakes for reproducible builds and development environments |
| 13 | +- `stacklock2nix` for deriving Nix packages from stack.yaml.lock |
| 14 | +- `devenv` for creating consistent development environments |
11 | 15 |
|
12 | | -``` |
13 | | -trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= |
14 | | -substituters = https://cache.iog.io https://cache.nixos.org |
15 | | -``` |
| 16 | +### Flake.nix |
16 | 17 |
|
17 | | -Restart the `nix-daemon` service: |
| 18 | +The flake.nix file has the following inputs: |
| 19 | +- `nixpkgs`: Standard Nix packages repository |
| 20 | +- `stacklock2nix`: A tool for generating Nix packages from stack.yaml.lock files |
18 | 21 |
|
19 | | -``` |
20 | | -sudo launchctl stop org.nixos.nix-daemon |
21 | | -sudo launchctl start org.nixos.nix-daemon |
22 | | -``` |
| 22 | +The flake outputs: |
| 23 | +- `packages.default`: The Hapistrano package for each supported system |
| 24 | +- `overlays.default`: An overlay for integrating Hapistrano into other Nix |
| 25 | + systems |
23 | 26 |
|
24 | | -If the following messages appear running the scripts detailed in the section |
25 | | -below, it means that Nix is not picking up the substituters we described |
26 | | -earlier and is unable to use them as a derivation cache: |
| 27 | +## Development Environments |
27 | 28 |
|
28 | | -``` |
29 | | -warning: ignoring untrusted substituter 'https://cache.iog.io' |
30 | | -``` |
31 | | -in which case |
32 | | -it is recommended to go over the steps detailed in this section again, or look for alternative ways to add extra substituters in [nix.conf](https://nix.dev/manual/nix/2.18/command-ref/conf-file). |
33 | | - |
34 | | -## Enabling the development environment |
| 29 | +The project includes a `devenv.nix` configuration that provides a consistent |
| 30 | +development environment with all necessary dependencies. |
35 | 31 |
|
36 | | -To enable the development environment exposed by the project's [Nix flake](../flake.nix), you can start a development shell by running the following command from within the project's root: |
| 32 | +To use devenv: |
37 | 33 |
|
38 | 34 | ``` |
39 | | -nix develop |
| 35 | +devenv shell |
40 | 36 | ``` |
41 | 37 |
|
42 | | -Alternatively, if you are using [nix-direnv](https://github.com/nix-community/nix-direnv) (recommended), you can run: |
| 38 | +The devenv configuration includes: |
| 39 | +- Essential tools like git, stack, and zsh |
| 40 | +- System-specific dependencies (e.g., gmp for Linux systems) |
| 41 | + |
| 42 | +### Using nix-direnv |
| 43 | + |
| 44 | +If you are using [nix-direnv](https://github.com/nix-community/nix-direnv), run: |
43 | 45 |
|
44 | 46 | ``` |
45 | 47 | direnv allow |
46 | 48 | ``` |
47 | 49 |
|
48 | | -that will enable the development shell according to the contents of [.envrc](../.envrc). It is advisable not to run `direnv allow` blindly and always check the contents of [.envrc](../.envrc) files first to ensure nothing malicious is executed. |
| 50 | +This will enable the development shell according to the contents of |
| 51 | +[.envrc](../.envrc). Always check the contents of [.envrc](../.envrc) files |
| 52 | +before running `direnv allow` to ensure nothing malicious is executed. |
0 commit comments