Merge pull request #14447 from mucaho/vscode_unfree
vscode: switch to unfree, binary package
This commit is contained in:
commit
19e425fa0c
@ -1,90 +1,50 @@
|
|||||||
{ callPackage, stdenv, fetchurl, makeWrapper
|
{ stdenv, callPackage, fetchurl, unzip
|
||||||
, jq, xlibs, gtk, python, nodejs
|
|
||||||
, ...
|
, ...
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
let
|
let
|
||||||
electron = callPackage ../../../development/tools/electron/default.nix (args // rec {
|
atomEnv = callPackage ../../../development/tools/electron/env-atom.nix (args);
|
||||||
version = "0.35.6";
|
|
||||||
sha256 = "1bwn14769nby04zkza9jphsya2p6fjnkm1k2y4h5y2l4gnqdvmx0";
|
version = "0.10.10";
|
||||||
});
|
rev = "5b5f4db87c10345b9d5c8d0bed745bcad4533135";
|
||||||
|
sha256 = if stdenv.system == "i686-linux" then "1mmgq4fxi2h4hvz7yxgzzyvlznkb42qwr8i1g2b1akdlgnrvvpby"
|
||||||
|
else if stdenv.system == "x86_64-linux" then "1zjb6mys5qs9mb21rpgpnbgq4gpnw6gsgfn5imf7ca7myk1bxnvk"
|
||||||
|
else if stdenv.system == "x86_64-darwin" then "0y1as2s6nhicyvdfszphhqp76iv9wcygglrl2f0jamm98g9qp66p"
|
||||||
|
else throw "Unsupported system: ${stdenv.system}";
|
||||||
|
|
||||||
|
urlMod = if stdenv.system == "i686-linux" then "linux-ia32"
|
||||||
|
else if stdenv.system == "x86_64-linux" then "linux-x64"
|
||||||
|
else if stdenv.system == "x86_64-darwin" then "darwin"
|
||||||
|
else throw "Unsupported system: ${stdenv.system}";
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "vscode-${version}";
|
name = "vscode-${version}";
|
||||||
version = "0.10.10";
|
inherit version;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/Microsoft/vscode/archive/${version}.tar.gz";
|
url = "https://az764295.vo.msecnd.net/stable/${rev}/VSCode-${urlMod}-stable.zip";
|
||||||
sha256 = "1mzkip6621111xwwksqjad1kgpbhna4dhpkf6cnj2r18dkk2jmcw";
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ makeWrapper jq xlibs.libX11 xlibs.xproto gtk python nodejs electron ];
|
buildInputs = [ unzip ];
|
||||||
|
|
||||||
extensionGalleryJSON = ''
|
|
||||||
{
|
|
||||||
\"extensionsGallery\": {
|
|
||||||
\"serviceUrl\": \"https://marketplace.visualstudio.com/_apis/public/gallery\",
|
|
||||||
\"cacheUrl\": \"https://vscode.blob.core.windows.net/gallery/index\",
|
|
||||||
\"itemUrl\": \"https://marketplace.visualstudio.com/items\"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
configurePhase = ''
|
|
||||||
# PATCH SCRIPT SHEBANGS
|
|
||||||
echo "PATCH SCRIPT SHEBANGS"
|
|
||||||
patchShebangs ./scripts
|
|
||||||
|
|
||||||
# ADD EXTENSION GALLERY URLS TO APPLICATION CONFIGURATION
|
|
||||||
echo "AUGMENT APPLICATION CONFIGURATION"
|
|
||||||
echo "$(cat ./product.json) ${extensionGalleryJSON}" | jq -s add > tmpFile && \
|
|
||||||
mv tmpFile ./product.json
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
# BUILD COMPILE- & RUN-TIME DEPENDENCIES
|
|
||||||
echo "BUILD COMPILE- & RUN-TIME DEPENDENCIES"
|
|
||||||
mkdir -p ./tmp
|
|
||||||
HOME=./tmp ./scripts/npm.sh install
|
|
||||||
|
|
||||||
# COMPILE SOURCES
|
|
||||||
echo "COMPILE SOURCES"
|
|
||||||
./node_modules/.bin/gulp
|
|
||||||
'';
|
|
||||||
|
|
||||||
doCheck = true;
|
|
||||||
checkPhase = ''
|
|
||||||
# CHECK APPLICATION
|
|
||||||
echo "CHECK APPLICATION"
|
|
||||||
ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 ${electron}/bin/electron ./node_modules/.bin/_mocha
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
# PRUNE COMPILE-TIME DEPENDENCIES
|
mkdir -p $out/bin
|
||||||
echo "PRUNE COMPILE-TIME DEPENDENCIES"
|
cp -r ./* $out/bin
|
||||||
npm prune --production
|
|
||||||
|
|
||||||
# COPY FILES NEEDED FOR RUNNING APPLICATION TO OUT DIRECTORY
|
${if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then ''
|
||||||
echo "COPY FILES NEEDED FOR RUNNING APPLICATION TO OUT DIRECTORY"
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||||
mkdir -p "$out"
|
$out/bin/code
|
||||||
cp -R ./.vscode "$out"/.vscode
|
'' else ""}
|
||||||
cp -R ./extensions "$out"/extensions
|
'';
|
||||||
cp -R ./out "$out"/out
|
|
||||||
cp -R ./node_modules "$out"/node_modules
|
|
||||||
cp ./package.json "$out"/package.json
|
|
||||||
cp ./product.json "$out"/product.json
|
|
||||||
cp ./tslint.json "$out"/tslint.json
|
|
||||||
# COPY LEGAL STUFF
|
|
||||||
cp ./LICENSE.txt "$out"/LICENSE.txt
|
|
||||||
cp ./OSSREADME.json "$out"/OSSREADME.json
|
|
||||||
cp ./ThirdPartyNotices.txt "$out"/ThirdPartyNotices.txt
|
|
||||||
|
|
||||||
# CREATE RUNNER SCRIPT
|
postFixup = ''
|
||||||
echo "CREATE RUNNER SCRIPT"
|
${if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then ''
|
||||||
mkdir -p "$out"/bin
|
patchelf \
|
||||||
makeWrapper "${electron}/bin/electron" "$out/bin/vscode" \
|
--set-rpath "${atomEnv}/lib:${atomEnv}/lib64:$out/bin:$(patchelf --print-rpath $out/bin/code)" \
|
||||||
--set VSCODE_DEV 1 \
|
$out/bin/code
|
||||||
--add-flags "$out"
|
'' else ""}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
@ -95,7 +55,8 @@ in
|
|||||||
It is also customizable, so users can change the editor's theme, keyboard shortcuts, and preferences.
|
It is also customizable, so users can change the editor's theme, keyboard shortcuts, and preferences.
|
||||||
'';
|
'';
|
||||||
homepage = http://code.visualstudio.com/;
|
homepage = http://code.visualstudio.com/;
|
||||||
license = licenses.mit;
|
downloadPage = https://code.visualstudio.com/Updates;
|
||||||
platforms = [ "x86_64-linux" ];
|
license = licenses.unfree;
|
||||||
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,16 @@
|
|||||||
{ stdenv, fetchurl, buildEnv, zlib, glib, alsaLib
|
{ stdenv, callPackage, fetchurl, unzip
|
||||||
, dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
|
, ...
|
||||||
, cairo, cups, expat, libgpgerror, nspr, gconf, nss, xorg, libcap, unzip
|
} @ args:
|
||||||
, systemd, libnotify
|
|
||||||
, version ? "0.36.2", sha256 ? "01d78j8dfrdygm1r141681b3bfz1f1xqg9vddz7j52z1mlfv9f1d", ...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
atomEnv = buildEnv {
|
atomEnv = callPackage ./env-atom.nix (args);
|
||||||
name = "env-atom";
|
|
||||||
paths = [
|
|
||||||
stdenv.cc.cc zlib glib dbus gtk atk pango freetype libgnome_keyring3
|
|
||||||
fontconfig gdk_pixbuf cairo cups expat libgpgerror alsaLib nspr gconf nss
|
|
||||||
xorg.libXrender xorg.libX11 xorg.libXext xorg.libXdamage xorg.libXtst
|
|
||||||
xorg.libXcomposite xorg.libXi xorg.libXfixes xorg.libXrandr
|
|
||||||
xorg.libXcursor libcap systemd libnotify
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
name = "electron-${version}";
|
name = "electron-${version}";
|
||||||
inherit version;
|
version = "0.36.2";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/atom/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip";
|
url = "https://github.com/atom/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip";
|
||||||
inherit sha256;
|
sha256 = "01d78j8dfrdygm1r141681b3bfz1f1xqg9vddz7j52z1mlfv9f1d";
|
||||||
name = "${name}.zip";
|
name = "${name}.zip";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
17
pkgs/development/tools/electron/env-atom.nix
Normal file
17
pkgs/development/tools/electron/env-atom.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{ stdenv, buildEnv, zlib, glib, alsaLib
|
||||||
|
, dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
|
||||||
|
, cairo, cups, expat, libgpgerror, nspr, gconf, nss, xorg, libcap
|
||||||
|
, systemd, libnotify
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildEnv {
|
||||||
|
name = "env-atom";
|
||||||
|
paths = [
|
||||||
|
stdenv.cc.cc zlib glib dbus gtk atk pango freetype libgnome_keyring3
|
||||||
|
fontconfig gdk_pixbuf cairo cups expat libgpgerror alsaLib nspr gconf nss
|
||||||
|
xorg.libXrender xorg.libX11 xorg.libXext xorg.libXdamage xorg.libXtst
|
||||||
|
xorg.libXcomposite xorg.libXi xorg.libXfixes xorg.libXrandr
|
||||||
|
xorg.libXcursor libcap systemd libnotify
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user