From 05fb140b36fbb7af0f6fa8196739748011205a12 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 22 Nov 2023 17:25:49 +0100 Subject: [PATCH 1/2] Add `shell.nix` to enable development on NixOS --- shell.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..61d4ed176 --- /dev/null +++ b/shell.nix @@ -0,0 +1,22 @@ +# Defines an environment for `nix-shell` for developing Fornjot on NixOS. +# +# This is not complete, and probably not the correct NixOS way to do it either. +# It's just what works for me (@hannobraun) in combination with my local +# environment. Pull requests to improve this (best coupled with thorough +# explanations, because I understand very little about Nix/NixOS) welcome! + +{ pkgs ? import { } }: + +pkgs.mkShell { + packages = with pkgs; [ + # Used as a local build tool. + just + + # Required by dependencies. + openssl + pkg-config + ]; + + # Otherwise `export-validator` produces an error trying to link `libstdc++`. + LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; +} From 686f2054d2ead252bf9ca4a155334ceef501041c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 22 Nov 2023 17:26:15 +0100 Subject: [PATCH 2/2] Add configuration for Nix Environment Selector This is a VS Code extension that I use to make rust-analyzer work with the `shell.nix` that I added in the previous commit. --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 186d12056..c557a1507 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "rust-analyzer.diagnostics.disabled": [ "mismatched-arg-count" ], - "rust-analyzer.check.command": "clippy" + "rust-analyzer.check.command": "clippy", + "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix" } \ No newline at end of file