From f9df6eb34053c286c0cded89fa90ec78600b5eaa Mon Sep 17 00:00:00 2001 From: Lyla Bravo Date: Sat, 31 Oct 2020 17:05:19 -0300 Subject: [PATCH] Added configuration options (fixed) --- default.nix | 76 +++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/default.nix b/default.nix index 838ebab..9cb9740 100644 --- a/default.nix +++ b/default.nix @@ -1,8 +1,10 @@ let - zig-overlay = import (builtins.fetchGit { - url = "https://github.com/arqv/zig-overlay.git"; - rev = "a56601116906a2f192702e0b97487b8e7f796fdc"; - }); + zig-overlay = import ( + builtins.fetchGit { + url = "https://github.com/arqv/zig-overlay.git"; + rev = "a56601116906a2f192702e0b97487b8e7f796fdc"; + } + ); pkgs = import { overlays = [ zig-overlay ]; }; gitignoreSrc = pkgs.fetchFromGitHub { @@ -13,39 +15,39 @@ let }; inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource; - zig = pkgs.zig.custom { - sha256 = "7d715ea8948611734986d8a056fdec98d0f39b064e38efcd088823c02b1afba8"; - version = "0.6.0+91a1c20e7"; - }; -in - pkgs.stdenvNoCC.mkDerivation { - name = "zls"; - version = "master"; - src = gitignoreSource ./.; - nativeBuildInputs = [ - zig - ]; + zig-default = pkgs.zig.master; +in { + zig ? zig-default, + extraConfig ? {} +}: - dontConfigure = true; - buildPhase = '' - zig build -Drelease-safe=true - ''; - installPhase = '' - mkdir -p $out - zig build install --prefix $out +pkgs.stdenvNoCC.mkDerivation { + name = "zls"; + version = "master"; + src = gitignoreSource ./.; + nativeBuildInputs = [ + zig + ]; - # write configuration according to defaults described in README.md - cat << EOF > $out/bin/zls.json - { - "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 - } - EOF - ''; + dontConfigure = true; + buildPhase = '' + zig build -Drelease-safe=true + ''; + installPhase = '' + mkdir -p $out + zig build install --prefix $out - XDG_CACHE_HOME = "."; - } + 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"; +}