Skip to content

Instantly share code, notes, and snippets.

@Gabriella439
Created January 7, 2022 16:14
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Gabriella439/b542f6e171f17d5f77a844d848278e14 to your computer and use it in GitHub Desktop.
Save Gabriella439/b542f6e171f17d5f77a844d848278e14 to your computer and use it in GitHub Desktop.
Nix build of vscode with haskell-language-server
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz";
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq";
};
config = {
allowUnfree = true;
};
ghcVersion = "8107";
overlay = pkgsNew: pkgsOld: {
haskell-language-server = pkgsOld.haskell-language-server.override {
supportedGhcVersions = [ ghcVersion ];
};
haskell = pkgsOld.haskell // {
packages = pkgsOld.haskell.packages // {
"ghc${ghcVersion}" = pkgsOld.haskell.packages."ghc${ghcVersion}".override (old: {
overrides =
pkgsNew.lib.composeExtensions (old.overrides or (_: _: { }))
(haskellPackagesNew: haskellPackagesOld: {
ormolu =
if pkgsNew.system == "aarch64-darwin"
then
pkgsNew.haskell.lib.overrideCabal
haskellPackagesOld.ormolu
(_: { enableSeparateBinOutput = false; })
else
haskellPackagesOld.ormolu;
});
});
};
};
vscode-with-extensions = pkgsOld.vscode-with-extensions.override {
vscodeExtensions = [
pkgsNew.vscode-extensions.haskell.haskell
pkgsNew.vscode-extensions.justusadam.language-haskell
];
};
};
pkgs = import nixpkgs { inherit config; overlays = [ overlay ];};
in
{ inherit (pkgs)
haskell-language-server
vscode-with-extensions
;
}
@runeksvendsen
Copy link

runeksvendsen commented Mar 12, 2022

Looks like this depends on python as well as some weird "relative directory"-logic. The content of

(import ./default.nix).vscode-with-extensions + "/bin/code"

points to /nix/store/1066bs33qpbwa9k6b4lg71wg31q4xa9s-vscode-1.63.0/bin/code which contains:

$ cat /nix/store/1066bs33qpbwa9k6b4lg71wg31q4xa9s-vscode-1.63.0/bin/code
#!/nix/store/3npg6a8nc5vpcyw98v085cmlz7f78kgs-bash-5.1-p12/bin/bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

function realpath() { python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0"; }
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --ms-enable-electron-run-as-node "$@"
exit $?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment