Skip to content

Commit deb8bfb

Browse files
authored
Merge pull request #4 from Saghen/nix-flake
feat: add nix flake
2 parents 26f6101 + be0999b commit deb8bfb

File tree

3 files changed

+124
-1
lines changed

3 files changed

+124
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ flagset = "0.4.6"
3131
encoding_rs = "0.8"
3232
url = "2.5.2"
3333
smol_str = "0.3.2"
34-
tera = "1.20.0"
34+
tera = "1.20.0"

flake.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
description = "EmmyLua Language Server";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
rust-overlay = {
7+
url = "github:oxalica/rust-overlay";
8+
inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
flake-utils.url = "github:numtide/flake-utils";
11+
};
12+
13+
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
14+
flake-utils.lib.eachDefaultSystem (system:
15+
let
16+
overlays = [ (import rust-overlay) ];
17+
pkgs = import nixpkgs { inherit system overlays; };
18+
19+
cargoToml =
20+
builtins.fromTOML (builtins.readFile ./crates/emmylua_ls/Cargo.toml);
21+
in {
22+
packages.default = pkgs.rustPlatform.buildRustPackage {
23+
pname = cargoToml.package.name;
24+
version = cargoToml.package.version;
25+
26+
src = ./.;
27+
cargoLock = { lockFile = ./Cargo.lock; };
28+
29+
nativeBuildInputs = with pkgs; [ pkg-config ];
30+
buildInputs = with pkgs; [ stdenv.cc.cc.lib ];
31+
32+
buildAndTestSubdir = "crates/emmylua_ls";
33+
34+
postFixup = ''
35+
patchelf --set-rpath "${pkgs.stdenv.cc.cc.lib}/lib" $out/bin/emmylua_ls
36+
'';
37+
};
38+
39+
packages.emmylua_ls = self.packages.${system}.default;
40+
});
41+
}

0 commit comments

Comments
 (0)