Skip to content

Commit

Permalink
add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
pr2502 committed Aug 15, 2024
1 parent ba9874f commit 7c90bb2
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/.direnv
82 changes: 82 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
description = ''
Language server proxy which enables sharing a single language server,
like rust-analyzer, between multiple LSP clients (editor windows).
'';

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
utils.url = "github:numtide/flake-utils";

rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, rust-overlay, utils }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};

rustToolchain = pkgs.rust-bin.stable."1.80.1".minimal;
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};

rustDev = rustToolchain.override {
extensions = ["rust-src" "rust-analyzer" "rust-docs" "clippy"];
};
# We want to use some unstable options in `rustfmt.toml` and
# unfortunately the only way to do that is use nightly rustfmt.
rustFmt = pkgs.rust-bin.nightly."2024-07-07".minimal.override {
extensions = ["rustfmt"];
};
in {
packages.default = rustPlatform.buildRustPackage {
pname = "ra-multiplex";
version = "0.2.5";
src = self;
cargoLock.lockFile = ./Cargo.lock;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
rustDev
rustFmt
];
};
});
}

0 comments on commit 7c90bb2

Please sign in to comment.