zls/flake.nix

51 lines
1.6 KiB
Nix
Raw Normal View History

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
zig-overlay.url = "github:mitchellh/zig-overlay";
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
2022-07-19 04:42:20 +01:00
flake-utils.url = "github:numtide/flake-utils";
known-folders.url = "github:ziglibs/known-folders";
known-folders.flake = false;
diffz.url = "github:ziglibs/diffz";
diffz.flake = false;
tres.url = "github:ziglibs/tres";
tres.flake = false;
};
outputs = { self, nixpkgs, zig-overlay, gitignore, flake-utils, known-folders, tres }:
let
2022-07-19 04:42:20 +01:00
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
inherit (gitignore.lib) gitignoreSource;
in
flake-utils.lib.eachSystem systems (system:
2022-07-19 04:42:20 +01:00
let
pkgs = nixpkgs.legacyPackages.${system};
zig = zig-overlay.packages.${system}.master;
in
rec {
2022-07-19 04:42:20 +01:00
packages.default = packages.zls;
packages.zls = pkgs.stdenvNoCC.mkDerivation {
name = "zls";
version = "master";
src = gitignoreSource ./.;
nativeBuildInputs = [ zig ];
dontConfigure = true;
dontInstall = true;
buildPhase = ''
mkdir -p $out
zig build install -Dcpu=baseline -Doptimize=ReleaseSafe -Ddata_version=master -Dtres=${tres}/tres.zig -Dknown-folders=${known-folders}/known-folders.zig -Ddiffz=${diffz}/DiffMatchPatch.zig --prefix $out
2022-07-19 04:42:20 +01:00
'';
XDG_CACHE_HOME = ".cache";
};
}
);
}