diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-03-03 20:48:28 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-03-03 22:53:18 +0100 |
commit | 28d46aac23257c007dc164d993238216401e7d14 (patch) | |
tree | 43a676b2a191549fe10537c4ffd53f642d6ab651 /README.md | |
parent | e3e9739f04976f65804c01a747ea0cef14bdabb9 (diff) |
Add NixOS instructions to readme.
- Closes #685
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 61 |
1 files changed, 61 insertions, 0 deletions
@@ -229,6 +229,67 @@ $ sudo pacman -S git cargo clang make pkg-config nettle openssl capnproto sqlite $ sudo dnf install git rustc cargo clang make pkg-config nettle-devel openssl-devel capnproto sqlite-devel ``` +### NixOS + +Development environment for use with `nix-shell` or `direnv`: +<details> + <summary> + `shell.nix` + </summary> + +```nix +let + moz_overlay = import (builtins.fetchTarball + "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz"); + nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; }; + rust_channel = (nixpkgs.rustChannelOf { rustToolchain = ./rust-toolchain; }); +in with nixpkgs; +pkgs.mkShell { + buildInputs = [ + nettle + openssl + sqlite + + # for the python bindings + (python3.withPackages + (python-packages: with python-packages; [ setuptools pip ])) + ]; + + nativeBuildInputs = [ + (rust_channel.rust.override{ + extensions = [ "rust-src" "rust-std" ]; + }) + + llvmPackages.clang + pkgconfig + capnproto + + # for the python bindings + (python3.withPackages + (python-packages: with python-packages; [ setuptools pip ])) + + # tools + codespell + ]; + + RUST_BACKTRACE = 1; + + # NixOS enables "fortify" by default, but that is incompatible with + # gcc -O0 in `make -Cffi examples`. + hardeningDisable = [ "fortify" ]; + + # compilation of -sys packages requires manually setting LIBCLANG_PATH + LIBCLANG_PATH = "${pkgs.llvmPackages.libclang}/lib"; + + # Workaround for https://github.com/mozilla/nixpkgs-mozilla/issues/240 + # with Rust 1.46.0 + LD_LIBRARY_PATH = ''${zlib.out}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}''; +} +``` + +</details> + + ### macOS (Mojave), using MacPorts ```shell |