Skip to content

Instantly share code, notes, and snippets.

@mankyKitty
Created August 1, 2018 05:15
Show Gist options
  • Save mankyKitty/3e802e9791671c404656fadb18b2a1a6 to your computer and use it in GitHub Desktop.
Save mankyKitty/3e802e9791671c404656fadb18b2a1a6 to your computer and use it in GitHub Desktop.
Nix expression for building vscode on nixos with a specific list of extensions
{ pkgs ? import <nixpkgs> {}
}:
with pkgs;
let
hie =
import (fetchTarball "https://github.com/puffnfresh/hie-nix/archive/6b1fd52e4946dc0d94c7892238d06be51a079d31.tar.gz") { inherit pkgs; };
hieWrapper = writeShellScriptBin "hie" ''
argv=( "$@" )
exec nix-shell --pure --run "${hie.hie82}/bin/hie ''${argv[*]}"
'';
version = "1.25.1";
plat = "linux-x64";
myvscode = vscode.overrideAttrs( old: {
inherit version plat;
name = "vscode-${version}";
src = fetchurl {
name = "VSCode_${version}_${plat}.tar.gz";
url = "https://vscode-update.azurewebsites.net/${version}/${plat}/stable";
sha256 = "0f1lpwyxfchmbymzzxv97w9cy1z5pdljhwm49mc5v84aygmvnmjq";
};
});
exts = import ./extensions.nix;
new_vscode = vscode-with-extensions.override {
vscode = myvscode;
vscodeExtensions = with vscode-extensions; [ bbenoist.Nix ]
++ vscode-utils.extensionsFromVscodeMarketplace (
__filter (e: e.name != "Nix") exts.extensions
);
};
codez = {
code = runCommand "${new_vscode.name}" { nativeBuildInputs = [ makeWrapper ]; } ''
mkdir -p $out/bin
makeWrapper \
${new_vscode}/bin/code \
$out/bin/code \
--prefix PATH : ${lib.makeBinPath [ cabal-install hieWrapper ]}
'';
};
in
codez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment