Last active
May 22, 2020 02:43
-
-
Save purcell/e1be2eaf2b79b44b714b82b5b99ba49b to your computer and use it in GitHub Desktop.
shell.nix with nimlsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
# Assumes niv sources, which should include the repos for | |
# nimlsp, ast-pattern-matching and jsonschema. | |
sources = import ./nix/sources.nix; | |
pkgs = import sources.nixpkgs {}; | |
unpackedSource = d: d.overrideAttrs (orig: { | |
name = "${orig.pname}-source"; | |
phases = ["unpackPhase" "patchPhase" "installPhase"]; | |
installPhase = "mkdir $out; cp -aR . $out/."; | |
}); | |
nimlsp = pkgs.stdenv.mkDerivation { | |
name = "nimlsp"; | |
src = sources.nimlsp; | |
buildInputs = [ pkgs.nim ]; | |
buildPhase = '' | |
mkdir -p $TMPDIR/.nimcache | |
mkdir -p $out/bin | |
nim c --nimcache:$TMPDIR/.nimcache \ | |
-d:tempDir= \ | |
-d:explicitSourcePath:${unpackedSource pkgs.nim} \ | |
--path:${unpackedSource pkgs.nim}/nimsuggest \ | |
--path:${sources.nim-ast-pattern-matching}/src \ | |
--path:${sources.nim-jsonschema}/src \ | |
-o:$out/bin/nimlsp src/nimlsp | |
rm -r $TMPDIR/.nimcache | |
''; | |
phases = ["unpackPhase" "buildPhase"]; | |
}; | |
in | |
pkgs.mkShell { | |
NIX_PATH = "nixpkgs=${sources.nixpkgs}"; | |
buildInputs = [ | |
pkgs.nixpkgs-fmt | |
pkgs.niv | |
pkgs.nim | |
nimlsp | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment