Merge pull request #339 from bnjmnt4n/nix

[WIP] Fix Nix build
This commit is contained in:
Alexandros Naskos 2021-06-06 01:21:30 +03:00 committed by GitHub
commit 39d8718864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,13 @@
{ pkgs ? import <nixpkgs> {},
system ? builtins.currentSystem }:
let let
zig-overlay = import (builtins.fetchGit { zig-overlay = pkgs.fetchFromGitHub {
url = "https://github.com/arqv/zig-overlay.git"; owner = "arqv";
rev = "a56601116906a2f192702e0b97487b8e7f796fdc"; repo = "zig-overlay";
}); rev = "5b9504b8bff072553051d6e130727f7f5c0715c3";
pkgs = import <nixpkgs> { overlays = [ zig-overlay ]; }; sha256 = "NDm5qT6/qr789IhI2dsQxrR5/Mr7cXVj17x/+tl3pDE=";
};
gitignoreSrc = pkgs.fetchFromGitHub { gitignoreSrc = pkgs.fetchFromGitHub {
owner = "hercules-ci"; owner = "hercules-ci";
repo = "gitignore"; repo = "gitignore";
@ -11,8 +15,8 @@ let
sha256 = "1npnx0h6bd0d7ql93ka7azhj40zgjp815fw2r6smg8ch9p7mzdlx"; sha256 = "1npnx0h6bd0d7ql93ka7azhj40zgjp815fw2r6smg8ch9p7mzdlx";
}; };
inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource; inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource;
zig-default = pkgs.zig.master; zig = (import zig-overlay { inherit pkgs system; }).master.latest;
in { zig ? zig-default, extraConfig ? { } }: in
pkgs.stdenvNoCC.mkDerivation { pkgs.stdenvNoCC.mkDerivation {
name = "zls"; name = "zls";
version = "master"; version = "master";
@ -23,18 +27,6 @@ pkgs.stdenvNoCC.mkDerivation {
buildPhase = '' buildPhase = ''
mkdir -p $out mkdir -p $out
zig build install -Drelease-safe=true -Ddata_version=master --prefix $out zig build install -Drelease-safe=true -Ddata_version=master --prefix $out
cat << EOF > $out/bin/zls.json
${
builtins.toJSON ({
zig_lib_path = "${zig}/lib/zig/";
zig_exe_path = "${zig}/bin/zig";
warn_style = false;
enable_snippets = false;
enable_semantic_tokens = false;
operator_completions = true;
} // extraConfig)
}
EOF
''; '';
XDG_CACHE_HOME = ".cache"; XDG_CACHE_HOME = ".cache";
} }