Fix Nix derivation

This commit is contained in:
Lyla Bravo 2020-10-31 17:36:37 -03:00
parent f9df6eb340
commit efdda5c51b

View File

@ -1,12 +1,9 @@
let let
zig-overlay = import ( zig-overlay = import (builtins.fetchGit {
builtins.fetchGit { url = "https://github.com/arqv/zig-overlay.git";
url = "https://github.com/arqv/zig-overlay.git"; rev = "a56601116906a2f192702e0b97487b8e7f796fdc";
rev = "a56601116906a2f192702e0b97487b8e7f796fdc"; });
}
);
pkgs = import <nixpkgs> { overlays = [ zig-overlay ]; }; pkgs = import <nixpkgs> { overlays = [ zig-overlay ]; };
gitignoreSrc = pkgs.fetchFromGitHub { gitignoreSrc = pkgs.fetchFromGitHub {
owner = "hercules-ci"; owner = "hercules-ci";
repo = "gitignore"; repo = "gitignore";
@ -14,40 +11,30 @@ 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-default = pkgs.zig.master;
in { in { zig ? zig-default, extraConfig ? { } }:
zig ? zig-default,
extraConfig ? {}
}:
pkgs.stdenvNoCC.mkDerivation { pkgs.stdenvNoCC.mkDerivation {
name = "zls"; name = "zls";
version = "master"; version = "master";
src = gitignoreSource ./.; src = gitignoreSource ./.;
nativeBuildInputs = [ nativeBuildInputs = [ zig ];
zig
];
dontConfigure = true; dontConfigure = true;
dontInstall = true;
buildPhase = '' buildPhase = ''
zig build -Drelease-safe=true
'';
installPhase = ''
mkdir -p $out mkdir -p $out
zig build install --prefix $out zig build install -Drelease-safe=true -Ddata_version=master --prefix $out
cat << EOF > $out/bin/zls.json cat << EOF > $out/bin/zls.json
${builtins.toJSON { ${
zig_lib_path = "${zig}/lib/zig/"; builtins.toJSON ({
zig_exe_path = "${zig}/bin/zig"; zig_lib_path = "${zig}/lib/zig/";
warn_style = false; zig_exe_path = "${zig}/bin/zig";
enable_snippets = false; warn_style = false;
enable_semantic_tokens = false; enable_snippets = false;
operator_completions = true; enable_semantic_tokens = false;
} // extraConfig} operator_completions = true;
} // extraConfig)
}
EOF EOF
''; '';
XDG_CACHE_HOME = ".cache"; XDG_CACHE_HOME = ".cache";
} }