-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* underpinnings of flake for LSP * use LSP-lib. specify the same ENV as the compiler is wrapped in for the LSP executable. * update Idris2 and LSP-lib submodules to latest commits
- Loading branch information
1 parent
9e44cee
commit 6c3475d
Showing
6 changed files
with
276 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ | |
/tests/**/output | ||
|
||
src/Server/Generated.idr | ||
|
||
#nix build output | ||
/result |
Submodule Idris2
updated
61 files
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(import (fetchTarball | ||
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") { | ||
src = builtins.fetchGit ./.; | ||
}) | ||
.defaultNix |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
description = "Idris 2 Language Server"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs"; | ||
|
||
idris = { | ||
url = "github:idris-lang/Idris2"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
|
||
lsp-lib = { | ||
url = "github:idris-community/LSP-lib"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
inputs.idris.follows = "idris"; | ||
}; | ||
|
||
alejandra = { | ||
url = "github:kamadorueda/alejandra/3.0.0"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
alejandra, | ||
idris, | ||
lsp-lib, | ||
}: let | ||
lib = nixpkgs.lib; | ||
# support the same systems as Idris2 | ||
systems = builtins.attrNames idris.packages; | ||
forEachSystem = with lib; | ||
mkOutputs: let | ||
outputsForSystem = system: | ||
concatMapAttrs (k: v: {${k}.${system} = v;}) (mkOutputs system); | ||
in | ||
foldl' recursiveUpdate {} (map outputsForSystem systems); | ||
in | ||
forEachSystem ( | ||
system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
idrisPkgs = idris.packages.${system}; | ||
buildIdris = idris.buildIdris.${system}; | ||
lspLib = lsp-lib.packages.${system}.default; | ||
supportLibrariesPath = lib.makeLibraryPath [idrisPkgs.support]; | ||
supportSharePath = lib.makeSearchPath "share" [idrisPkgs.support]; | ||
|
||
globalLibraries = let | ||
idrName = "idris2-${idris.version}"; | ||
libSuffix = "lib/${idrName}"; | ||
in [ | ||
"\\$HOME/.nix-profile/lib/${idrName}" | ||
"/run/current-system/sw/lib/${idrName}" | ||
"${idrisPkgs.idris2}/${idrName}" | ||
]; | ||
globalLibrariesPath = builtins.concatStringsSep ":" globalLibraries; | ||
|
||
lspPkg = buildIdris { | ||
projectName = "idris2-lsp"; | ||
src = ./.; | ||
idrisLibraries = [idrisPkgs.idris2-api lspLib]; | ||
buildInputs = [pkgs.makeWrapper]; | ||
postInstall = '' | ||
wrapProgram $out/bin/idris2-lsp \ | ||
--run 'export IDRIS2_PREFIX=''${IDRIS2_PREFIX-"$HOME/.idris2"}' \ | ||
--suffix IDRIS2_LIBS ':' "${supportLibrariesPath}" \ | ||
--suffix IDRIS2_DATA ':' "${supportSharePath}" \ | ||
--suffix IDRIS2_PACKAGE_PATH ':' "${globalLibrariesPath}" | ||
''; | ||
}; | ||
in rec { | ||
packages = | ||
idrisPkgs | ||
// rec { | ||
idris2-lsp = lspPkg.executable; | ||
default = idris2-lsp; | ||
}; | ||
formatter = alejandra.packages.${system}.default; | ||
} | ||
); | ||
} |