From 10f03e19c018a2ed200f9fa04e20897bff57f6d9 Mon Sep 17 00:00:00 2001 From: CEbbinghaus <git@cebbinghaus.com> Date: Tue, 21 Jan 2025 20:26:43 +1100 Subject: [PATCH] Added shell.nix to create dev environment (#3362) --- CODEOWNERS | 2 ++ rust-toolchain.toml | 2 ++ shell.nix | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 rust-toolchain.toml create mode 100644 shell.nix diff --git a/CODEOWNERS b/CODEOWNERS index f6e57524b..fccf9d157 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,4 @@ # yale-mistakes were made /pykanidm/* @yaleman +# Least qualified nix guy :P +shell.nix @cebbinghaus diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..31578d3bf --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable" \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..2f07072c3 --- /dev/null +++ b/shell.nix @@ -0,0 +1,25 @@ +{ pkgs ? import <nixpkgs> {} }: + let + overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)); +in +pkgs.mkShellNoCC rec { + # Kanidm dependencies + buildInputs = with pkgs; [ + pkg-config + + cargo + rustc + + clang + llvmPackages.bintools + + openssl + ] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [ + systemd + linux-pam + ]; + + RUSTC_VERSION = overrides.toolchain.channel; + # https://github.com/rust-lang/rust-bindgen#environment-variables + LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ]; +} \ No newline at end of file