git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #14418 from mucaho/vscode

Add visual studio code editor

commita703bd49a9a528fb451b69b707c463f474d2d660 authorjoachifm <joachifm@users.noreply.github.com> dateSun 3 Apr 2016, 19:07 (11 years ago) parentb83efccaa38510
3 files changed+112−6
pkgs/applications/editors/vscode/default.nix+97 pkgs/development/tools/electron/default.nix+11−6 pkgs/top-level/all-packages.nix+4
pkgs/applications/editors/vscode/default.nixnew file+97
@@ -0,0 +1,97 @@
1+{ callPackage, stdenv, fetchurl, makeWrapper
2+, jq, xlibs, gtk, python, nodejs
3+, ...
4+} @ args:
5+
6+let
7+ electron = callPackage ../../../development/tools/electron/default.nix (args // rec {
8+ version = "0.35.6";
9+ sha256 = "1bwn14769nby04zkza9jphsya2p6fjnkm1k2y4h5y2l4gnqdvmx0";
10+ });
11+in
12+ stdenv.mkDerivation rec {
13+ name = "vscode-${version}";
14+ version = "0.10.10";
15+
16+ src = fetchurl {
17+ url = "https://github.com/Microsoft/vscode/archive/${version}.tar.gz";
18+ sha256 = "1mzkip6621111xwwksqjad1kgpbhna4dhpkf6cnj2r18dkk2jmcw";
19+ };
20+
21+ buildInputs = [ makeWrapper jq xlibs.libX11 xlibs.xproto gtk python nodejs electron ];
22+
23+ extensionGalleryJSON = ''
24+ {
25+ \"extensionsGallery\": {
26+ \"serviceUrl\": \"https://marketplace.visualstudio.com/_apis/public/gallery\",
27+ \"cacheUrl\": \"https://vscode.blob.core.windows.net/gallery/index\",
28+ \"itemUrl\": \"https://marketplace.visualstudio.com/items\"
29+ }
30+ }
31+ '';
32+
33+ configurePhase = ''
34+ # PATCH SCRIPT SHEBANGS
35+ echo "PATCH SCRIPT SHEBANGS"
36+ patchShebangs ./scripts
37+
38+ # ADD EXTENSION GALLERY URLS TO APPLICATION CONFIGURATION
39+ echo "AUGMENT APPLICATION CONFIGURATION"
40+ echo "$(cat ./product.json) ${extensionGalleryJSON}" | jq -s add > tmpFile && \
41+ mv tmpFile ./product.json
42+ '';
43+
44+ buildPhase = ''
45+ # INSTALL COMPILE- & RUN-TIME DEPENDENCIES
46+ echo "INSTALL COMPILE- & RUN-TIME DEPENDENCIES"
47+ mkdir -p ./tmp
48+ HOME=./tmp ./scripts/npm.sh install
49+
50+ # COMPILE SOURCES
51+ echo "COMPILE SOURCES"
52+ ./node_modules/.bin/gulp
53+ '';
54+
55+ doCheck = true;
56+ checkPhase = ''
57+ # CHECK APPLICATION
58+ echo "CHECK APPLICATION"
59+ ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 ${electron}/bin/electron ./node_modules/.bin/_mocha
60+ '';
61+
62+ installPhase = ''
63+ # COPY FILES NEEDED FOR RUNNING APPLICATION TO OUT DIRECTORY
64+ echo "COPY FILES NEEDED FOR RUNNING APPLICATION TO OUT DIRECTORY"
65+ mkdir -p "$out"
66+ cp -R ./.vscode "$out"/.vscode
67+ cp -R ./extensions "$out"/extensions
68+ cp -R ./out "$out"/out
69+ cp -R ./node_modules "$out"/node_modules
70+ cp ./package.json "$out"/package.json
71+ cp ./product.json "$out"/product.json
72+ cp ./tslint.json "$out"/tslint.json
73+ # COPY LEGAL STUFF
74+ cp ./LICENSE.txt "$out"/LICENSE.txt
75+ cp ./OSSREADME.json "$out"/OSSREADME.json
76+ cp ./ThirdPartyNotices.txt "$out"/ThirdPartyNotices.txt
77+
78+ # CREATE RUNNER SCRIPT
79+ echo "CREATE RUNNER SCRIPT"
80+ mkdir -p "$out"/bin
81+ makeWrapper "${electron}/bin/electron" "$out/bin/vscode" \
82+ --set VSCODE_DEV 1 \
83+ --add-flags "$out"
84+ '';
85+
86+ meta = with stdenv.lib; {
87+ description = "Visual Studio Code is an open source source code editor developed by Microsoft for Windows, Linux and OS X.";
88+ longDescription = ''
89+ Visual Studio Code is an open source source code editor developed by Microsoft for Windows, Linux and OS X.
90+ It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.
91+ It is also customizable, so users can change the editor's theme, keyboard shortcuts, and preferences.
92+ '';
93+ homepage = http://code.visualstudio.com/;
94+ license = licenses.mit;
95+ platforms = [ "x86_64-linux" ];
96+ };
97+ }
pkgs/development/tools/electron/default.nix+11−6
@@ -1,7 +1,8 @@
1−{ stdenv, fetchurl, buildEnv, makeDesktopItem, makeWrapper, zlib, glib, alsaLib
1+{ stdenv, fetchurl, buildEnv, zlib, glib, alsaLib
22, dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
33, cairo, cups, expat, libgpgerror, nspr, gconf, nss, xorg, libcap, unzip
44, systemd, libnotify
5+, version ? "0.36.2", sha256 ? "01d78j8dfrdygm1r141681b3bfz1f1xqg9vddz7j52z1mlfv9f1d", ...
56}:
67let
78 atomEnv = buildEnv {
@@ -16,15 +17,15 @@ let
1617 };
1718in stdenv.mkDerivation rec {
1819 name = "electron-${version}";
19− version = "0.36.2";
20+ inherit version;
2021
2122 src = fetchurl {
2223 url = "https://github.com/atom/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip";
23− sha256 = "01d78j8dfrdygm1r141681b3bfz1f1xqg9vddz7j52z1mlfv9f1d";
24+ inherit sha256;
2425 name = "${name}.zip";
2526 };
2627
27− buildInputs = [ atomEnv makeWrapper unzip ];
28+ buildInputs = [ atomEnv unzip ];
2829
2930 phases = [ "installPhase" "fixupPhase" ];
3031
@@ -35,8 +36,12 @@ in stdenv.mkDerivation rec {
3536 unzip -d $out/bin $src
3637 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
3738 $out/bin/electron
38− wrapProgram $out/bin/electron \
39− --prefix "LD_LIBRARY_PATH" : "${atomEnv}/lib:${atomEnv}/lib64"
39+ '';
40+
41+ postFixup = ''
42+ patchelf \
43+ --set-rpath "${atomEnv}/lib:${atomEnv}/lib64:$out/bin:$(patchelf --print-rpath $out/bin/electron)" \
44+ $out/bin/electron
4045 '';
4146
4247 meta = with stdenv.lib; {
pkgs/top-level/all-packages.nix+4
@@ -14137,6 +14137,10 @@ in
1413714137
1413814138 vorbis-tools = callPackage ../applications/audio/vorbis-tools { };
1413914139
14140+ vscode = callPackage ../applications/editors/vscode {
14141+ gconf = pkgs.gnome.GConf;
14142+ };
14143+
1414014144 vue = callPackage ../applications/misc/vue { };
1414114145
1414214146 vwm = callPackage ../applications/window-managers/vwm { };