Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add vscodeEnv to shell.nix #132

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ cabal.project.local~
.HTF/
.ghc.environment.*
.directory
.vscode-exts/
.vscode-globalUserData/
.vscode/
mutable-extensions.nix
9 changes: 4 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
let
ghcVersion = "ghc865";
misoPkgs = import (builtins.fetchTarball {
{ ghcVersion ? "ghc865"
, misoPkgs ? import (builtins.fetchTarball {
url = "https://github.com/dmjio/miso/archive/561ffad.tar.gz";
sha256 = "1wwzckz2qxb873wdkwqmx9gmh0wshcdxi7gjwkba0q51jnkfdi41";
}) {};
in
}) {}
}:

with misoPkgs.pkgs;
with haskell.packages."${ghcVersion}";
Expand Down
50 changes: 42 additions & 8 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,43 @@
let pkgs = import <nixpkgs> { };
in (import ./.).env.overrideAttrs (_: {
{ ps ? import <nixpkgs> {}
, nixpkgs ? import (ps.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "f75d62941d8ad616bfc334ae19d71a0a6677dd19";
sha256 = "0n88r4fw1syad9zl7r40r7xlxwx38ni8s9hzyayxssr21ii2p38h";
}) {}
, ghcVersion ? "ghc865"
}:
with nixpkgs;
let
drv = import ./. { inherit ghcVersion;};
hie =
((import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {})
.selection { selector = p: { ${ghcVersion} = p.${ghcVersion}; }; });

in
drv.env.overrideAttrs (shellEnv: {
buildInputs = shellEnv.buildInputs ++ [
cabal2nix
freeman42x marked this conversation as resolved.
Show resolved Hide resolved
hie
(vscode-utils.vscodeEnv {
#usually this path go to tmp but feel free to change it wherever you think it is good place to the "fake" global folder
#putting it on empty string will leave the default one.
user-data-dir = "./.vscode-globalUserData";
#this file will be updated/created automaticly by vscode in result of using vscode GUI to install/uninstall extensions(can be changed manually to)
mutableExtensionsFile = ./mutable-extensions.nix;
#this extensions will be stored in the nix store and cannot be modified from vscode GUI
nixExtensions = [
{ name = "vscode-hie-server"; publisher = "alanz"; version = "0.0.40"; sha256 = "1cmlgidjma41s5zq5161gcxxmk5lfzcm8dvznls04y5l7q9b0gca"; }
{ name = "language-haskell"; publisher = "justusadam"; version = "3.2.0"; sha256 = "190h1hky2yy5n00ncqf15mmaizgpm3w9pzvasmi2gangpg4qb6y5"; }
];

# configuration for settings files- those will be overrides/create over the one in .vscode folder
# settings = {};
# keybindings ={};
})
];

shellHook = ''
PATH="$PATH:${pkgs.ghc}/bin:${pkgs.cabal-install}/bin:${pkgs.nwjs-sdk}/bin:${pkgs.ghcid}/bin:${
((import
(fetchTarball "https://github.com/infinisil/all-hies/tarball/master")
{ }).selection { selector = p: { inherit (p) ghc865; }; })
}/bin"'';
})
echo 'to start editor with HIE run on the root of the folder: code .'
'';
})