mirror of
https://github.com/haskell/haskell-language-server.git
synced 2024-10-26 09:20:16 +03:00
Add support for .env
shells to flake.nix
(#3322)
The main motivation for this change is to enable development of HLS plugins by generating a `.env` shell for every package in this repository. Example usage: ```ShellSession $ nix develop .#haskell-language-server-dev-env.hls-fourmolu-plugin ``` This is a plain shell, though, without any tooling installed, identical to the one that Nixpkgs provides by default.
This commit is contained in:
parent
5a8ccdbed0
commit
7c0201b509
13
flake.lock
13
flake.lock
@ -156,6 +156,18 @@
|
|||||||
"url": "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz"
|
"url": "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ghc-exactprint-160": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-6fW4KSmDo7hi5i2C1lbI/rEyFWrowSGTNyaC+f73JaE=",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://hackage.haskell.org/package/ghc-exactprint-1.6.0/ghc-exactprint-1.6.0.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://hackage.haskell.org/package/ghc-exactprint-1.6.0/ghc-exactprint-1.6.0.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -322,6 +334,7 @@
|
|||||||
"ghc-check": "ghc-check",
|
"ghc-check": "ghc-check",
|
||||||
"ghc-exactprint": "ghc-exactprint",
|
"ghc-exactprint": "ghc-exactprint",
|
||||||
"ghc-exactprint-150": "ghc-exactprint-150",
|
"ghc-exactprint-150": "ghc-exactprint-150",
|
||||||
|
"ghc-exactprint-160": "ghc-exactprint-160",
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore",
|
||||||
"hie-bios": "hie-bios",
|
"hie-bios": "hie-bios",
|
||||||
"hiedb": "hiedb",
|
"hiedb": "hiedb",
|
||||||
|
15
flake.nix
15
flake.nix
@ -362,6 +362,10 @@
|
|||||||
|
|
||||||
src = null;
|
src = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkEnvShell = hpkgs:
|
||||||
|
pkgs.lib.mapAttrs (name: value: hpkgs.${name}.env) pkgs.hlsSources;
|
||||||
|
|
||||||
# Create a hls executable
|
# Create a hls executable
|
||||||
# Copied from https://github.com/NixOS/nixpkgs/blob/210784b7c8f3d926b7db73bdad085f4dc5d79428/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix#L16
|
# Copied from https://github.com/NixOS/nixpkgs/blob/210784b7c8f3d926b7db73bdad085f4dc5d79428/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix#L16
|
||||||
mkExe = hpkgs:
|
mkExe = hpkgs:
|
||||||
@ -394,6 +398,15 @@
|
|||||||
haskell-language-server-942-dev-nix = mkDevShellWithNixDeps ghc942 "cabal.project";
|
haskell-language-server-942-dev-nix = mkDevShellWithNixDeps ghc942 "cabal.project";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# The default shell provided by Nixpkgs for a Haskell package (i.e. the
|
||||||
|
# one that comes in the `.env` attribute)
|
||||||
|
envShells = {
|
||||||
|
haskell-language-server-dev-env = mkEnvShell ghcDefault;
|
||||||
|
haskell-language-server-902-dev-env = mkEnvShell ghc902;
|
||||||
|
haskell-language-server-924-dev-env = mkEnvShell ghc924;
|
||||||
|
haskell-language-server-942-dev-env = mkEnvShell ghc942;
|
||||||
|
};
|
||||||
|
|
||||||
allPackages = {
|
allPackages = {
|
||||||
haskell-language-server = mkExe ghcDefault;
|
haskell-language-server = mkExe ghcDefault;
|
||||||
haskell-language-server-902 = mkExe ghc902;
|
haskell-language-server-902 = mkExe ghc902;
|
||||||
@ -401,7 +414,7 @@
|
|||||||
haskell-language-server-942 = mkExe ghc942;
|
haskell-language-server-942 = mkExe ghc942;
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells = simpleDevShells // nixDevShells // {
|
devShells = simpleDevShells // nixDevShells // envShells // {
|
||||||
default = simpleDevShells.haskell-language-server-dev;
|
default = simpleDevShells.haskell-language-server-dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user