zls/flake.nix
LeRoyce Pearson 5010de46db Make known-folders a flake input
Simpler than using `fetchFromGitHub`, we can have `nix` manage the
version instead
2022-07-19 00:08:04 -06:00

43 lines
1.4 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
zig-overlay.url = "github:arqv/zig-overlay";
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
known-folders.url = "github:ziglibs/known-folders";
known-folders.flake = false;
};
outputs = {self, nixpkgs, zig-overlay, gitignore, flake-utils, known-folders }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
inherit (gitignore.lib) gitignoreSource;
in flake-utils.lib.eachSystem systems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
zig = zig-overlay.packages.${system}.master.latest;
in rec {
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 -Drelease-safe=true -Ddata_version=master -Dknown-folders=${known-folders}/known-folders.zig --prefix $out
'';
XDG_CACHE_HOME = ".cache";
};
}
);
}