You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

2 years ago
  1. let
  2. basePkgs = import ./nix/nixpkgs.nix { };
  3. rust_overlay = with basePkgs; import (fetchFromGitHub
  4. (lib.importJSON ./nix/oxalica_rust_overlay.json));
  5. pkgs = import ./nix/nixpkgs.nix { overlays = [ rust_overlay ]; };
  6. nightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
  7. extensions = [ "rustfmt" ];
  8. });
  9. stableToolchain = pkgs.rust-bin.stable."1.56.1".minimal.override {
  10. extensions = [ "clippy" "llvm-tools-preview" "rust-src" ];
  11. };
  12. pre-commit-check = pkgs.callPackage ./nix/pre-commit.nix { };
  13. in
  14. with pkgs;
  15. mkShell {
  16. buildInputs = [
  17. argbash
  18. openssl
  19. pkgconfig
  20. git
  21. stableToolchain
  22. nightlyToolchain
  23. ] ++ lib.optionals stdenv.isDarwin [
  24. darwin.apple_sdk.frameworks.Security
  25. ];
  26. shellHook = ''
  27. export RUST_BACKTRACE=full
  28. export PATH="$PATH:$(pwd)/target/debug:$(pwd)/target/release"
  29. # Ensure `cargo fmt` uses `rustfmt` from nightly.
  30. export RUSTFMT="${nightlyToolchain}/bin/rustfmt"
  31. # install pre-commit hooks
  32. ${pre-commit-check.shellHook}
  33. '';
  34. }