1
1
mirror of https://github.com/oxalica/nil.git synced 2024-11-23 12:03:30 +03:00
nil/flake.nix

66 lines
2.0 KiB
Nix
Raw Normal View History

2022-08-04 10:53:05 +03:00
{
description = "Language Server for Nix Expression Language";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.flake-utils.follows = "flake-utils";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, flake-utils, nixpkgs, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (builtins) substring;
pkgs = nixpkgs.legacyPackages.${system};
rustPkgs = rust-overlay.packages.${system};
in {
packages = rec {
default = nil;
nil = pkgs.rustPlatform.buildRustPackage {
pname = "nil";
version = let mtime = self.lastModifiedDate; in
"unstable-${substring 0 4 mtime}-${substring 4 2 mtime}-${substring 6 2 mtime}";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
buildAndTestSubdir = "lsp";
};
};
devShells.default = pkgs.mkShell {
packages = [
# Override the stable rustfmt.
rustPkgs.rust-nightly_2022-08-01.availableComponents.rustfmt
rustPkgs.rust
pkgs.gdb
2022-08-04 10:53:05 +03:00
pkgs.jq
(import ./neovim-env.nix { inherit pkgs; })
];
RUST_BACKTRACE = "short";
2022-08-04 10:53:05 +03:00
NIXPKGS = nixpkgs;
# bash
2022-08-04 10:53:05 +03:00
shellHook = ''
export NIL_PATH="$(cargo metadata --format-version=1 | jq -r .target_directory)/debug/nil"
2022-08-04 10:53:05 +03:00
'';
};
2022-08-09 10:14:02 +03:00
devShells.fuzz = pkgs.mkShell {
packages = [
rustPkgs.rust-nightly_2022-08-01
pkgs.cargo-fuzz
2022-08-09 12:01:01 +03:00
pkgs.llvmPackages_14.llvm
pkgs.jq
pkgs.gnugrep
2022-08-09 10:14:02 +03:00
];
RUST_BACKTRACE = "short";
2022-08-09 12:01:01 +03:00
# bash
shellHook = ''
export CARGO_TARGET_DIR=~/.cache/targets-syntax
'';
2022-08-09 10:14:02 +03:00
};
2022-08-04 10:53:05 +03:00
});
}