Merge pull request #237545 from drupol/openvscode-server/bump-june-2023

openvscode-server: 1.78.2 -> 1.79.0
This commit is contained in:
Pol Dellaiera 2023-06-13 17:55:46 +02:00 committed by GitHub
commit 4ab538636f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 42 deletions

View File

@ -4,7 +4,8 @@ let
cfg = config.services.openvscode-server;
defaultUser = "openvscode-server";
defaultGroup = defaultUser;
in {
in
{
options = {
services.openvscode-server = {
enable = lib.mkEnableOption (lib.mdDoc "openvscode-server");
@ -126,12 +127,12 @@ in {
};
telemetryLevel = lib.mkOption {
default = "off";
default = null;
example = "crash";
description = lib.mdDoc ''
Sets the initial telemetry level. Valid levels are: 'off', 'crash', 'error' and 'all'.
'';
type = lib.types.str;
type = lib.types.nullOr (lib.types.enum [ "off" "crash" "error" "all" ]);
};
connectionToken = lib.mkOption {
@ -167,23 +168,23 @@ in {
--accept-server-license-terms \
--host=${cfg.host} \
--port=${toString cfg.port} \
'' + lib.optionalString (cfg.telemetryLevel == true) ''
--telemetry-level=${cfg.telemetryLevel} \
'' + lib.optionalString (cfg.withoutConnectionToken == true) ''
--without-connection-token \
'' + lib.optionalString (cfg.socketPath != null) ''
--socket-path=${cfg.socketPath} \
'' + lib.optionalString (cfg.userDataDir != null) ''
--user-data-dir=${cfg.userDataDir} \
'' + lib.optionalString (cfg.serverDataDir != null) ''
--server-data-dir=${cfg.serverDataDir} \
'' + lib.optionalString (cfg.extensionsDir != null) ''
--extensions-dir=${cfg.extensionsDir} \
'' + lib.optionalString (cfg.connectionToken != null) ''
--connection-token=${cfg.connectionToken} \
'' + lib.optionalString (cfg.connectionTokenFile != null) ''
--connection-token-file=${cfg.connectionTokenFile} \
'' + lib.escapeShellArgs cfg.extraArguments;
'' + lib.optionalString (cfg.telemetryLevel != null) ''
--telemetry-level=${cfg.telemetryLevel} \
'' + lib.optionalString (cfg.withoutConnectionToken) ''
--without-connection-token \
'' + lib.optionalString (cfg.socketPath != null) ''
--socket-path=${cfg.socketPath} \
'' + lib.optionalString (cfg.userDataDir != null) ''
--user-data-dir=${cfg.userDataDir} \
'' + lib.optionalString (cfg.serverDataDir != null) ''
--server-data-dir=${cfg.serverDataDir} \
'' + lib.optionalString (cfg.extensionsDir != null) ''
--extensions-dir=${cfg.extensionsDir} \
'' + lib.optionalString (cfg.connectionToken != null) ''
--connection-token=${cfg.connectionToken} \
'' + lib.optionalString (cfg.connectionTokenFile != null) ''
--connection-token-file=${cfg.connectionTokenFile} \
'' + lib.escapeShellArgs cfg.extraArguments;
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
RuntimeDirectory = cfg.user;
User = cfg.user;

View File

@ -1,13 +1,32 @@
{ lib, stdenv, fetchFromGitHub, buildGoModule, makeWrapper
, cacert, moreutils, jq, git, pkg-config, yarn, python3
, esbuild, nodejs, libsecret, xorg, ripgrep
, AppKit, Cocoa, Security, cctools, nixosTests }:
{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, makeWrapper
, cacert
, moreutils
, jq
, git
, pkg-config
, yarn
, python3
, esbuild
, nodejs
, libsecret
, xorg
, ripgrep
, AppKit
, Cocoa
, Security
, cctools
, nixosTests
}:
let
system = stdenv.hostPlatform.system;
yarn' = yarn.override { inherit nodejs; };
defaultYarnOpts = [ "frozen-lockfile" "non-interactive" "no-progress"];
defaultYarnOpts = [ "frozen-lockfile" "non-interactive" "no-progress" ];
vsBuildTarget = {
x86_64-linux = "linux-x64";
@ -30,27 +49,27 @@ let
};
# replaces esbuild's download script with a binary from nixpkgs
patchEsbuild = path : version : ''
patchEsbuild = path: version: ''
mkdir -p ${path}/node_modules/esbuild/bin
jq "del(.scripts.postinstall)" ${path}/node_modules/esbuild/package.json | sponge ${path}/node_modules/esbuild/package.json
sed -i 's/${version}/${esbuild'.version}/g' ${path}/node_modules/esbuild/lib/main.js
ln -s -f ${esbuild'}/bin/esbuild ${path}/node_modules/esbuild/bin/esbuild
'';
in stdenv.mkDerivation rec {
in
stdenv.mkDerivation (finalAttrs: {
pname = "openvscode-server";
version = "1.78.2";
version = "1.79.0";
src = fetchFromGitHub {
owner = "gitpod-io";
repo = "openvscode-server";
rev = "openvscode-server-v${version}";
sha256 = "sha256-+Q/j3h7ZvNDxrjEk01QUOrVwcwGW4OBBpmfjEtHQj2o=";
rev = "openvscode-server-v${finalAttrs.version}";
hash = "sha256-dVzGyK1ybZywCm602zWJroSCQ2wx5IzV+HqwZUsEgKU=";
};
yarnCache = stdenv.mkDerivation {
name = "${pname}-${version}-${system}-yarn-cache";
inherit src;
name = "${finalAttrs.pname}-${finalAttrs.version}-${system}-yarn-cache";
inherit (finalAttrs) src;
nativeBuildInputs = [ cacert yarn' git ];
buildPhase = ''
export HOME=$PWD
@ -68,17 +87,27 @@ in stdenv.mkDerivation rec {
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-XOFBXYP3c4vbvl0/uXsmo8FdO/2PudzJhm9L+9VArdI=";
outputHash = "sha256-P6mzeE3HnS/KoP7kCXJlDkFWkTKiGjJkOUXfGOru/xE=";
};
nativeBuildInputs = [
nodejs yarn' python3 pkg-config makeWrapper git jq moreutils
nodejs
yarn'
python3
pkg-config
makeWrapper
git
jq
moreutils
];
buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ]
++ (with xorg; [ libX11 libxkbfile ])
++ lib.optionals stdenv.isDarwin [
AppKit Cocoa Security cctools
];
AppKit
Cocoa
Security
cctools
];
patches = [
# Patch out remote download of nodejs from build script
@ -100,19 +129,25 @@ in stdenv.mkDerivation rec {
'';
configurePhase = ''
runHook preConfigure
# set default yarn opts
${lib.concatMapStrings (option: ''
yarn --offline config set ${option}
'') defaultYarnOpts}
# set offline mirror to yarn cache we created in previous steps
yarn --offline config set yarn-offline-mirror "${yarnCache}"
yarn --offline config set yarn-offline-mirror "${finalAttrs.yarnCache}"
# set nodedir, so we can build binaries later
npm config set nodedir "${nodejs}"
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
# install dependencies
yarn --offline --ignore-scripts
@ -155,27 +190,33 @@ in stdenv.mkDerivation rec {
# build and minify
yarn --offline gulp vscode-reh-web-${vsBuildTarget}-min
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -R -T ../vscode-reh-web-${vsBuildTarget} $out
ln -s ${nodejs}/bin/node $out
runHook postInstall
'';
passthru.tests = {
inherit (nixosTests) openvscode-server;
};
meta = with lib; {
meta = {
description = "Run VS Code on a remote machine";
longDescription = ''
Run upstream VS Code on a remote machine with access through a modern web
browser from any device, anywhere.
'';
homepage = "https://github.com/gitpod-io/openvscode-server";
license = licenses.mit;
maintainers = with maintainers; [ dguenther ghuntley emilytrau ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dguenther ghuntley emilytrau ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
};
}
})