hapistrano/docs/NIX.md

49 lines
1.7 KiB
Markdown
Raw Normal View History

Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
# Nix
## Requirements
- Install [Nix](https://nixos.org/download.html)
- Enable Flakes [permanently](https://nixos.wiki/wiki/Flakes#Permanent)
**For macOS users**
Add the following lines to configuration file located at `/etc/nix/nix.conf`:
```
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org
```
Restart the `nix-daemon` service:
```
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon
```
If the following messages appear running the scripts detailed in the section
below, it means that Nix is not picking up the substituters we described
earlier and is unable to use them as a derivation cache:
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
```
warning: ignoring untrusted substituter 'https://cache.iog.io'
```
in which case
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).
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
## Enabling the development environment
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
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:
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
```
nix develop
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
```
Alternatively, if you are using [nix-direnv](https://github.com/nix-community/nix-direnv) (recommended), you can run:
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
```
direnv allow
Reproducible development and test environments (#212) * Setting up Nix / Running the build using Nix * Delete other CI workflows (temporarily) * Add cabal update * Cache dependencies * Run tests * Add missing dependency required for testing * Add macos-latest runner * Exclude GHC 8.10 on macos-latest * Trying something with haskell.nix overlays * Trying to compile the project with an external flake * Pass --accept-flake-config flag * Install GHC package provided by haskell-nix * Pass --accept-flake-config and enable ubuntu-latest * Remove hello project * Update substituters * Test with ubuntu * Disable macos * Add stdenv.cc.cc.lib * Testing ghc90 running on ubuntu-latest * Install GMP dev * Remove .dev from gmp * Use propagatedBuildInputs * Install stdenv * Add --verbose=3 * Test ghc810 running on ubuntu-latest * Install libstdc++6 * Fix typo * Run nix-info * Add nix-path * List /usr/lib/x86_64-linux-gnu * Run cabal clean before cabal build * Run without cache * Turn on cache again * Run all builds * Run ghc90 on ubuntu-latest only * Install ghc from haskell on Linux and haskell-nix on Mac * Re-enable cache * Add labels to steps * Add scripts to run nix-shells * Install zsh * Exclude GHC 8.10 from macOS * Install zsh only on Linux * Minor refactoring * Merge nix workflow into build * Remove nix workflow * Update README file * Fix merge conflicts * Fix runs-on * Add cache.nixos.org config * Exclude ghc90 on macos-latest * Add note about GHC 9.0 running on macOS * Update flake.lock * Run GHC 9.0 (macOS) * Print GHC and cabal versions * Disable docker job (temp change) * Fix compilation issue * Refactor documentation * Re-enable docker job * Update comment in the .cabal file * Revert .cabal file changes * Extract nix content to a separate file * Extract nix content to a separate file * Update README file * Update TODO section * Remove .tmuxinator.yml * Remove table of content from the README file * Fix typo in command * Update Nix docs * Update restart instructions
2023-04-18 16:27:59 +03:00
```
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.