Merge pull request #264358 from RaitoBezarius/drop-nodejs

This commit is contained in:
Ryan Lahfa 2023-11-17 23:26:13 +01:00 committed by GitHub
commit d3530f494c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 15 additions and 1064 deletions

View File

@ -550,6 +550,10 @@ The module update takes care of the new config syntax and the data itself (user
## Nixpkgs internals {#sec-release-23.11-nixpkgs-internals}
- Node.js v14, v16 has been removed as they were end of life. Any dependent packages that contributors were not able to reasonably upgrade were dropped after a month of notice to their maintainers, were **removed**.
- This includes VSCode Server.
- This includes Kibana 7 as the ELK stack is unmaintained in nixpkgs and is marked for slow removal.
- The use of `sourceRoot = "source";`, `sourceRoot = "source/subdir";`, and similar lines in package derivations using the default `unpackPhase` is deprecated as it requires `unpackPhase` to always produce a directory named "source". Use `sourceRoot = src.name`, `sourceRoot = "${src.name}/subdir";`, or `setSourceRoot = "sourceRoot=$(echo */subdir)";` or similar instead.
- The `django` alias in the python package set was upgraded to Django 4.x.

View File

@ -1147,7 +1147,6 @@
./services/search/elasticsearch-curator.nix
./services/search/elasticsearch.nix
./services/search/hound.nix
./services/search/kibana.nix
./services/search/meilisearch.nix
./services/search/opensearch.nix
./services/search/qdrant.nix
@ -1241,7 +1240,6 @@
./services/web-apps/changedetection-io.nix
./services/web-apps/chatgpt-retrieval-plugin.nix
./services/web-apps/cloudlog.nix
./services/web-apps/code-server.nix
./services/web-apps/convos.nix
./services/web-apps/dex.nix
./services/web-apps/discourse.nix

View File

@ -1,213 +0,0 @@
{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.kibana;
opt = options.services.kibana;
ge7 = builtins.compareVersions cfg.package.version "7" >= 0;
lt6_6 = builtins.compareVersions cfg.package.version "6.6" < 0;
cfgFile = pkgs.writeText "kibana.json" (builtins.toJSON (
(filterAttrsRecursive (n: v: v != null && v != []) ({
server.host = cfg.listenAddress;
server.port = cfg.port;
server.ssl.certificate = cfg.cert;
server.ssl.key = cfg.key;
kibana.index = cfg.index;
kibana.defaultAppId = cfg.defaultAppId;
elasticsearch.url = cfg.elasticsearch.url;
elasticsearch.hosts = cfg.elasticsearch.hosts;
elasticsearch.username = cfg.elasticsearch.username;
elasticsearch.password = cfg.elasticsearch.password;
elasticsearch.ssl.certificate = cfg.elasticsearch.cert;
elasticsearch.ssl.key = cfg.elasticsearch.key;
elasticsearch.ssl.certificateAuthorities = cfg.elasticsearch.certificateAuthorities;
} // cfg.extraConf)
)));
in {
options.services.kibana = {
enable = mkEnableOption (lib.mdDoc "kibana service");
listenAddress = mkOption {
description = lib.mdDoc "Kibana listening host";
default = "127.0.0.1";
type = types.str;
};
port = mkOption {
description = lib.mdDoc "Kibana listening port";
default = 5601;
type = types.port;
};
cert = mkOption {
description = lib.mdDoc "Kibana ssl certificate.";
default = null;
type = types.nullOr types.path;
};
key = mkOption {
description = lib.mdDoc "Kibana ssl key.";
default = null;
type = types.nullOr types.path;
};
index = mkOption {
description = lib.mdDoc "Elasticsearch index to use for saving kibana config.";
default = ".kibana";
type = types.str;
};
defaultAppId = mkOption {
description = lib.mdDoc "Elasticsearch default application id.";
default = "discover";
type = types.str;
};
elasticsearch = {
url = mkOption {
description = lib.mdDoc ''
Elasticsearch url.
Defaults to `"http://localhost:9200"`.
Don't set this when using Kibana >= 7.0.0 because it will result in a
configuration error. Use {option}`services.kibana.elasticsearch.hosts`
instead.
'';
default = null;
type = types.nullOr types.str;
};
hosts = mkOption {
description = lib.mdDoc ''
The URLs of the Elasticsearch instances to use for all your queries.
All nodes listed here must be on the same cluster.
Defaults to `[ "http://localhost:9200" ]`.
This option is only valid when using kibana >= 6.6.
'';
default = null;
type = types.nullOr (types.listOf types.str);
};
username = mkOption {
description = lib.mdDoc "Username for elasticsearch basic auth.";
default = null;
type = types.nullOr types.str;
};
password = mkOption {
description = lib.mdDoc "Password for elasticsearch basic auth.";
default = null;
type = types.nullOr types.str;
};
ca = mkOption {
description = lib.mdDoc ''
CA file to auth against elasticsearch.
It's recommended to use the {option}`certificateAuthorities` option
when using kibana-5.4 or newer.
'';
default = null;
type = types.nullOr types.path;
};
certificateAuthorities = mkOption {
description = lib.mdDoc ''
CA files to auth against elasticsearch.
Please use the {option}`ca` option when using kibana \< 5.4
because those old versions don't support setting multiple CA's.
This defaults to the singleton list [ca] when the {option}`ca` option is defined.
'';
default = lib.optional (cfg.elasticsearch.ca != null) ca;
defaultText = literalExpression ''
lib.optional (config.${opt.elasticsearch.ca} != null) ca
'';
type = types.listOf types.path;
};
cert = mkOption {
description = lib.mdDoc "Certificate file to auth against elasticsearch.";
default = null;
type = types.nullOr types.path;
};
key = mkOption {
description = lib.mdDoc "Key file to auth against elasticsearch.";
default = null;
type = types.nullOr types.path;
};
};
package = mkOption {
description = lib.mdDoc "Kibana package to use";
default = pkgs.kibana;
defaultText = literalExpression "pkgs.kibana";
type = types.package;
};
dataDir = mkOption {
description = lib.mdDoc "Kibana data directory";
default = "/var/lib/kibana";
type = types.path;
};
extraConf = mkOption {
description = lib.mdDoc "Kibana extra configuration";
default = {};
type = types.attrs;
};
};
config = mkIf (cfg.enable) {
assertions = [
{
assertion = ge7 -> cfg.elasticsearch.url == null;
message =
"The option services.kibana.elasticsearch.url has been removed when using kibana >= 7.0.0. " +
"Please use option services.kibana.elasticsearch.hosts instead.";
}
{
assertion = lt6_6 -> cfg.elasticsearch.hosts == null;
message =
"The option services.kibana.elasticsearch.hosts is only valid for kibana >= 6.6.";
}
];
systemd.services.kibana = {
description = "Kibana Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "elasticsearch.service" ];
environment = { BABEL_CACHE_PATH = "${cfg.dataDir}/.babelcache.json"; };
serviceConfig = {
ExecStart =
"${cfg.package}/bin/kibana" +
" --config ${cfgFile}" +
" --path.data ${cfg.dataDir}";
User = "kibana";
WorkingDirectory = cfg.dataDir;
};
};
environment.systemPackages = [ cfg.package ];
users.users.kibana = {
isSystemUser = true;
description = "Kibana service user";
home = cfg.dataDir;
createHome = true;
group = "kibana";
};
users.groups.kibana = {};
};
}

View File

@ -1,259 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.code-server;
defaultUser = "code-server";
defaultGroup = defaultUser;
in {
options = {
services.code-server = {
enable = lib.mkEnableOption (lib.mdDoc "code-server");
package = lib.mkPackageOptionMD pkgs "code-server" {
example = ''
pkgs.vscode-with-extensions.override {
vscode = pkgs.code-server;
vscodeExtensions = with pkgs.vscode-extensions; [
bbenoist.nix
dracula-theme.theme-dracula
];
}
'';
};
extraPackages = lib.mkOption {
default = [ ];
description = lib.mdDoc ''
Additional packages to add to the code-server {env}`PATH`.
'';
example = lib.literalExpression "[ pkgs.go ]";
type = lib.types.listOf lib.types.package;
};
extraEnvironment = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
description = lib.mdDoc ''
Additional environment variables to pass to code-server.
'';
default = { };
example = { PKG_CONFIG_PATH = "/run/current-system/sw/lib/pkgconfig"; };
};
extraArguments = lib.mkOption {
default = [ ];
description = lib.mdDoc ''
Additional arguments to pass to code-server.
'';
example = lib.literalExpression ''[ "--log=info" ]'';
type = lib.types.listOf lib.types.str;
};
host = lib.mkOption {
default = "localhost";
description = lib.mdDoc ''
The host name or IP address the server should listen to.
'';
type = lib.types.str;
};
port = lib.mkOption {
default = 4444;
description = lib.mdDoc ''
The port the server should listen to.
'';
type = lib.types.port;
};
auth = lib.mkOption {
default = "password";
description = lib.mdDoc ''
The type of authentication to use.
'';
type = lib.types.enum [ "none" "password" ];
};
hashedPassword = lib.mkOption {
default = "";
description = lib.mdDoc ''
Create the password with: `echo -n 'thisismypassword' | npx argon2-cli -e`.
'';
type = lib.types.str;
};
user = lib.mkOption {
default = defaultUser;
example = "yourUser";
description = lib.mdDoc ''
The user to run code-server as.
By default, a user named `${defaultUser}` will be created.
'';
type = lib.types.str;
};
group = lib.mkOption {
default = defaultGroup;
example = "yourGroup";
description = lib.mdDoc ''
The group to run code-server under.
By default, a group named `${defaultGroup}` will be created.
'';
type = lib.types.str;
};
extraGroups = lib.mkOption {
default = [ ];
description = lib.mdDoc ''
An array of additional groups for the `${defaultUser}` user.
'';
example = [ "docker" ];
type = lib.types.listOf lib.types.str;
};
socket = lib.mkOption {
default = null;
example = "/run/code-server/socket";
description = lib.mdDoc ''
Path to a socket (bind-addr will be ignored).
'';
type = lib.types.nullOr lib.types.str;
};
socketMode = lib.mkOption {
default = null;
description = lib.mdDoc ''
File mode of the socket.
'';
type = lib.types.nullOr lib.types.str;
};
userDataDir = lib.mkOption {
default = null;
description = lib.mdDoc ''
Path to the user data directory.
'';
type = lib.types.nullOr lib.types.str;
};
extensionsDir = lib.mkOption {
default = null;
description = lib.mdDoc ''
Path to the extensions directory.
'';
type = lib.types.nullOr lib.types.str;
};
proxyDomain = lib.mkOption {
default = null;
example = "code-server.lan";
description = lib.mdDoc ''
Domain used for proxying ports.
'';
type = lib.types.nullOr lib.types.str;
};
disableTelemetry = lib.mkOption {
default = false;
example = true;
description = lib.mdDoc ''
Disable telemetry.
'';
type = lib.types.bool;
};
disableUpdateCheck = lib.mkOption {
default = false;
example = true;
description = lib.mdDoc ''
Disable update check.
Without this flag, code-server checks every 6 hours against the latest github release and
then notifies you once every week that a new release is available.
'';
type = lib.types.bool;
};
disableFileDownloads = lib.mkOption {
default = false;
example = true;
description = lib.mdDoc ''
Disable file downloads from Code.
'';
type = lib.types.bool;
};
disableWorkspaceTrust = lib.mkOption {
default = false;
example = true;
description = lib.mdDoc ''
Disable Workspace Trust feature.
'';
type = lib.types.bool;
};
disableGettingStartedOverride = lib.mkOption {
default = false;
example = true;
description = lib.mdDoc ''
Disable the coder/coder override in the Help: Getting Started page.
'';
type = lib.types.bool;
};
};
};
config = lib.mkIf cfg.enable {
systemd.services.code-server = {
description = "Code server";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
path = cfg.extraPackages;
environment = {
HASHED_PASSWORD = cfg.hashedPassword;
} // cfg.extraEnvironment;
serviceConfig = {
ExecStart = ''
${lib.getExe cfg.package} \
--auth=${cfg.auth} \
--bind-addr=${cfg.host}:${toString cfg.port} \
'' + lib.optionalString (cfg.socket != null) ''
--socket=${cfg.socket} \
'' + lib.optionalString (cfg.userDataDir != null) ''
--user-data-dir=${cfg.userDataDir} \
'' + lib.optionalString (cfg.extensionsDir != null) ''
--extensions-dir=${cfg.extensionsDir} \
'' + lib.optionalString (cfg.disableTelemetry == true) ''
--disable-telemetry \
'' + lib.optionalString (cfg.disableUpdateCheck == true) ''
--disable-update-check \
'' + lib.optionalString (cfg.disableFileDownloads == true) ''
--disable-file-downloads \
'' + lib.optionalString (cfg.disableWorkspaceTrust == true) ''
--disable-workspace-trust \
'' + lib.optionalString (cfg.disableGettingStartedOverride == true) ''
--disable-getting-started-override \
'' + lib.escapeShellArgs cfg.extraArguments;
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
RuntimeDirectory = cfg.user;
User = cfg.user;
Group = cfg.group;
Restart = "on-failure";
};
};
users.users."${cfg.user}" = lib.mkMerge [
(lib.mkIf (cfg.user == defaultUser) {
isNormalUser = true;
description = "code-server user";
inherit (cfg) group;
})
{
packages = cfg.extraPackages;
inherit (cfg) extraGroups;
}
];
users.groups."${defaultGroup}" = lib.mkIf (cfg.group == defaultGroup) { };
};
meta.maintainers = [ lib.maintainers.stackshadow ];
}

View File

@ -192,7 +192,6 @@ in {
cntr = handleTestOn ["aarch64-linux" "x86_64-linux"] ./cntr.nix {};
cockpit = handleTest ./cockpit.nix {};
cockroachdb = handleTestOn ["x86_64-linux"] ./cockroachdb.nix {};
code-server = handleTest ./code-server.nix {};
coder = handleTest ./coder.nix {};
collectd = handleTest ./collectd.nix {};
connman = handleTest ./connman.nix {};

View File

@ -1,22 +0,0 @@
import ./make-test-python.nix ({pkgs, lib, ...}:
{
name = "code-server";
nodes = {
machine = {pkgs, ...}: {
services.code-server = {
enable = true;
auth = "none";
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("code-server.service")
machine.wait_for_open_port(4444)
machine.succeed("curl -k --fail http://localhost:4444", timeout=10)
'';
meta.maintainers = [ lib.maintainers.drupol ];
})

View File

@ -119,11 +119,6 @@ let
package = elk.elasticsearch;
};
kibana = {
enable = true;
package = elk.kibana;
};
elasticsearch-curator = {
enable = true;
actionYAML = ''
@ -217,13 +212,6 @@ let
one.wait_until_succeeds("cat /tmp/logstash.out | grep flowers")
one.wait_until_succeeds("cat /tmp/logstash.out | grep -v dragons")
with subtest("Kibana is healthy"):
one.wait_for_unit("kibana.service")
one.wait_until_succeeds(
"curl --silent --show-error --fail-with-body 'http://localhost:5601/api/status'"
+ " | jq -es 'if . == [] then null else .[] | .status.overall.state == \"green\" end'"
)
with subtest("Metricbeat is running"):
one.wait_for_unit("metricbeat.service")
@ -274,7 +262,6 @@ in {
# name = "elk-7";
# elasticsearch = pkgs.elasticsearch7-oss;
# logstash = pkgs.logstash7-oss;
# kibana = pkgs.kibana7-oss;
# filebeat = pkgs.filebeat7;
# metricbeat = pkgs.metricbeat7;
# };
@ -282,7 +269,6 @@ in {
ELK-7 = mkElkTest "elk-7" {
elasticsearch = pkgs.elasticsearch7;
logstash = pkgs.logstash7;
kibana = pkgs.kibana7;
filebeat = pkgs.filebeat7;
metricbeat = pkgs.metricbeat7;
};

View File

@ -2,7 +2,7 @@
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}:
let
nodeEnv = import ../../../node-packages/node-env.nix {

View File

@ -15,12 +15,11 @@
, runtimeShell
# List of Node.js runtimes the package should support
, nodeRuntimes ? [ "node20" ]
, nodejs_16
, nodejs_20
}:
# Node.js runtimes supported by upstream
assert builtins.all (x: builtins.elem x [ "node16" "node20" ]) nodeRuntimes;
assert builtins.all (x: builtins.elem x [ "node20" ]) nodeRuntimes;
buildDotnetModule rec {
pname = "github-runner";
@ -210,8 +209,6 @@ buildDotnetModule rec {
preCheck = ''
mkdir -p _layout/externals
'' + lib.optionalString (lib.elem "node16" nodeRuntimes) ''
ln -s ${nodejs_16} _layout/externals/node16
'' + lib.optionalString (lib.elem "node20" nodeRuntimes) ''
ln -s ${nodejs_20} _layout/externals/node20
'';
@ -250,8 +247,6 @@ buildDotnetModule rec {
# externals/node$version. As opposed to the official releases, we don't
# link the Alpine Node flavors.
mkdir -p $out/lib/externals
'' + lib.optionalString (lib.elem "node16" nodeRuntimes) ''
ln -s ${nodejs_16} $out/lib/externals/node16
'' + lib.optionalString (lib.elem "node20" nodeRuntimes) ''
ln -s ${nodejs_20} $out/lib/externals/node20
'' + ''

View File

@ -1,60 +0,0 @@
{ elk7Version
, enableUnfree ? true
, lib
, stdenv
, makeWrapper
, fetchurl
, nodejs_16
, coreutils
, which
}:
let
nodejs = nodejs_16;
inherit (builtins) elemAt;
info = lib.splitString "-" stdenv.hostPlatform.system;
arch = elemAt info 0;
plat = elemAt info 1;
hashes =
{
x86_64-linux = "sha512-09XokG5krjxGnk34DhxpLOGRLjb2jd82uZtwGfrzSuuqMpBhkEptK2oySGxuGdHF8uowwlR5p5YO2TvBwMsWkQ==";
x86_64-darwin = "sha512-cqRJnvu730Jfkr6vwbHUFuZube1g522cmvnDwTzhGGK6VN/7+9XL3vavqtUPDVdTLTUk+DrNiIQK7MaJH3SHMg==";
aarch64-linux = "sha512-zhtYThz5j4+w5gI1JWSnHv709Tk23eegVsrtYmdaYhZiTw2yvCTYI5uNAfBjBr8XPdp6CKF4e6Bh2wHKDYg1mg==";
aarch64-darwin = "sha512-cqRJnvu730Jfkr6vwbHUFuZube1g522cmvnDwTzhGGK6VN/7+9XL3vavqtUPDVdTLTUk+DrNiIQK7MaJH3SHMg==";
};
in stdenv.mkDerivation rec {
pname = "kibana";
version = elk7Version;
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/kibana/${pname}-${version}-${plat}-${arch}.tar.gz";
hash = hashes.${stdenv.hostPlatform.system} or (throw "Unknown architecture");
};
patches = [
# Kibana specifies it specifically needs nodejs 10.15.2 but nodejs in nixpkgs is at 10.15.3.
# The <nixpkgs/nixos/tests/elk.nix> test succeeds with this newer version so lets just
# disable the version check.
./disable-nodejs-version-check-7.patch
];
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/libexec/kibana $out/bin
mv * $out/libexec/kibana/
rm -r $out/libexec/kibana/node
makeWrapper $out/libexec/kibana/bin/kibana $out/bin/kibana \
--prefix PATH : "${lib.makeBinPath [ nodejs coreutils which ]}"
sed -i 's@NODE=.*@NODE=${nodejs}/bin/node@' $out/libexec/kibana/bin/kibana
'';
meta = with lib; {
description = "Visualize logs and time-stamped data";
homepage = "http://www.elasticsearch.org/overview/kibana";
license = licenses.elastic20;
maintainers = with maintainers; [ offline basvandijk ];
platforms = with platforms; unix;
};
}

View File

@ -1,19 +0,0 @@
diff --git a/src/setup_node_env/node_version_validator.js b/src/setup_node_env/node_version_validator.js
index 3f611e5a..f5c60c85 100644
--- a/src/setup_node_env/node_version_validator.js
+++ b/src/setup_node_env/node_version_validator.js
@@ -25,11 +25,11 @@ var pkg = require('../../package.json'); // Note: This is written in ES5 so we c
var currentVersion = process && process.version || null;
var rawRequiredVersion = pkg && pkg.engines && pkg.engines.node || null;
var requiredVersion = rawRequiredVersion ? 'v' + rawRequiredVersion : rawRequiredVersion;
-var isVersionValid = !!currentVersion && !!requiredVersion && currentVersion === requiredVersion; // Validates current the NodeJS version compatibility when Kibana starts.
+var isVersionValid = !!currentVersion && !!requiredVersion; // Validates current the NodeJS version compatibility when Kibana starts.
if (!isVersionValid) {
var errorMessage = 'Kibana does not support the current Node.js version ' + currentVersion + '. Please use Node.js ' + requiredVersion + '.'; // Actions to apply when validation fails: error report + exit.
console.error(errorMessage);
process.exit(1);
-}
\ No newline at end of file
+}

View File

@ -1,26 +0,0 @@
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python3, enableNpm ? true }:
let
# Clang 16+ cannot build Node v14 due to -Wenum-constexpr-conversion errors.
# Use an older version of clang with the current libc++ for compatibility (e.g., with icu).
ensureCompatibleCC = packages:
if packages.stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion packages.stdenv.cc.cc) "16"
then overrideCC packages.llvmPackages_15.stdenv (packages.llvmPackages_15.stdenv.cc.override {
inherit (packages.llvmPackages) libcxx;
extraPackages = [ packages.llvmPackages.libcxxabi ];
})
else packages.stdenv;
buildNodejs = callPackage ./nodejs.nix {
inherit openssl;
stdenv = ensureCompatibleCC pkgs;
buildPackages = buildPackages // { stdenv = ensureCompatibleCC buildPackages; };
python = python3;
};
in
buildNodejs {
inherit enableNpm;
version = "14.21.3";
sha256 = "sha256-RY7AkuYK1wDdzwectj1DXBXaTHuz0/mbmo5YqZ5UB14=";
patches = lib.optional pkgs.stdenv.isDarwin ./bypass-xcodebuild.diff;
}

View File

@ -1,35 +0,0 @@
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python3, fetchpatch, enableNpm ? true }:
let
# Clang 16+ cannot build Node v14 due to -Wenum-constexpr-conversion errors.
# Use an older version of clang with the current libc++ for compatibility (e.g., with icu).
ensureCompatibleCC = packages:
if packages.stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion packages.stdenv.cc.cc) "16"
then overrideCC packages.llvmPackages_15.stdenv (packages.llvmPackages_15.stdenv.cc.override {
inherit (packages.llvmPackages) libcxx;
extraPackages = [ packages.llvmPackages.libcxxabi ];
})
else packages.stdenv;
buildNodejs = callPackage ./nodejs.nix {
inherit openssl;
stdenv = ensureCompatibleCC pkgs;
buildPackages = buildPackages // { stdenv = ensureCompatibleCC buildPackages; };
python = python3;
};
npmPatches = callPackage ./npm-patches.nix { };
in
buildNodejs {
inherit enableNpm;
# If you do upgrade here, please update in pkgs/top-level/release.nix
# the permitted insecure version to ensure it gets cached for our users
# and backport this to stable release (23.05).
version = "16.20.2";
sha256 = "sha256-V28aA8RV5JGo0TK1h+trO4RlH8iXS7NjhDPdRNIsj0k=";
patches = [
./disable-darwin-v8-system-instrumentation.patch
./bypass-darwin-xcrun-node16.patch
./node-npm-build-npm-package-logic-node16.patch
] ++ npmPatches;
}

View File

@ -2,7 +2,7 @@
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}:
let
nodeEnv = import ./node-env.nix {

View File

@ -1,20 +0,0 @@
diff --git a/ci/build/build-vscode.sh b/ci/build/build-vscode.sh
index a72549fb..3aed1ad5 100755
--- a/ci/build/build-vscode.sh
+++ b/ci/build/build-vscode.sh
@@ -58,7 +58,6 @@ main() {
# telemetry available; telemetry can still be disabled by flag or setting).
# This needs to be done before building as Code will read this file and embed
# it into the client-side code.
- git checkout product.json # Reset in case the script exited early.
cp product.json product.original.json # Since jq has no inline edit.
jq --slurp '.[0] * .[1]' product.original.json <(
cat << EOF
@@ -105,7 +104,6 @@ EOF
# Reset so if you develop after building you will not be stuck with the wrong
# commit (the dev client will use `oss-dev` but the dev server will still use
# product.json which will have `stable-$commit`).
- git checkout product.json
popd

View File

@ -1,327 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, makeWrapper
, cacert
, moreutils
, jq
, git
, rsync
, pkg-config
, yarn
, python3
, esbuild
, nodejs
, node-gyp
, libsecret
, xorg
, ripgrep
, AppKit
, Cocoa
, CoreServices
, Security
, cctools
, xcbuild
, quilt
, nixosTests
}:
let
system = stdenv.hostPlatform.system;
python = python3;
yarn' = yarn.override { inherit nodejs; };
defaultYarnOpts = [ ];
esbuild' = esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.16.17";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-8L8h0FaexNsb3Mj6/ohA37nYLFogo5wXkAhGztGUUsQ=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
};
# replaces esbuild's download script with a binary from nixpkgs
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
'';
# Comment from @code-asher, the code-server maintainer
# See https://github.com/NixOS/nixpkgs/pull/240001#discussion_r1244303617
#
# If the commit is missing it will break display languages (Japanese, Spanish,
# etc). For some reason VS Code has a hard dependency on the commit being set
# for that functionality.
# The commit is also used in cache busting. Without the commit you could run
# into issues where the browser is loading old versions of assets from the
# cache.
# Lastly, it can be helpful for the commit to be accurate in bug reports
# especially when they are built outside of our CI as sometimes the version
# numbers can be unreliable (since they are arbitrarily provided).
#
# To compute the commit when upgrading this derivation, do:
# `$ git rev-parse <git-rev>` where <git-rev> is the git revision of the `src`
# Example: `$ git rev-parse v4.16.1`
commit = "94ef3776ad7bebfb5780dfc9632e04d20d5c9a6c";
in
stdenv.mkDerivation (finalAttrs: {
pname = "code-server";
version = "4.16.1";
src = fetchFromGitHub {
owner = "coder";
repo = "code-server";
rev = "v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-h4AooHHKV/EfN2S1z7CQKqnYW3uA3sKhSW4senlzjxI=";
};
yarnCache = stdenv.mkDerivation {
name = "${finalAttrs.pname}-${finalAttrs.version}-${system}-yarn-cache";
inherit (finalAttrs) src;
nativeBuildInputs = [ yarn' git cacert ];
buildPhase = ''
runHook preBuild
export HOME=$PWD
export GIT_SSL_CAINFO="${cacert}/etc/ssl/certs/ca-bundle.crt"
yarn --cwd "./vendor" install --modules-folder modules --ignore-scripts --frozen-lockfile
yarn config set yarn-offline-mirror $out
find "$PWD" -name "yarn.lock" -printf "%h\n" | \
xargs -I {} yarn --cwd {} \
--frozen-lockfile --ignore-scripts --ignore-platform \
--ignore-engines --no-progress --non-interactive
find ./lib/vscode -name "yarn.lock" -printf "%h\n" | \
xargs -I {} yarn --cwd {} \
--ignore-scripts --ignore-engines
runHook postBuild
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-vkju+oxEYrEXFAnjz/Mf1g0ZhxBALLAaRuWE0swSWwM=";
};
nativeBuildInputs = [
nodejs
yarn'
python
pkg-config
makeWrapper
git
rsync
jq
moreutils
quilt
];
buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ]
++ (with xorg; [ libX11 libxkbfile ])
++ lib.optionals stdenv.isDarwin [
AppKit
Cocoa
CoreServices
Security
cctools
xcbuild
];
patches = [
# Remove all git calls from the VS Code build script except `git rev-parse
# HEAD` which is replaced in postPatch with the commit.
./build-vscode-nogit.patch
];
postPatch = ''
export HOME=$PWD
patchShebangs ./ci
# inject git commit
substituteInPlace ./ci/build/build-vscode.sh \
--replace '$(git rev-parse HEAD)' "${commit}"
substituteInPlace ./ci/build/build-release.sh \
--replace '$(git rev-parse HEAD)' "${commit}"
'';
configurePhase = ''
runHook preConfigure
# run yarn offline by default
echo '--install.offline true' >> .yarnrc
# 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 "${finalAttrs.yarnCache}"
# skip unnecessary electron download
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
# set nodedir to prevent node-gyp from downloading headers
# taken from https://nixos.org/manual/nixpkgs/stable/#javascript-tool-specific
mkdir -p $HOME/.node-gyp/${nodejs.version}
echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
export npm_config_nodedir=${nodejs}
# use updated node-gyp. fixes the following error on Darwin:
# PermissionError: [Errno 1] Operation not permitted: '/usr/sbin/pkgutil'
export npm_config_node_gyp=${node-gyp}/lib/node_modules/node-gyp/bin/node-gyp.js
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
# install code-server dependencies
yarn --offline --ignore-scripts
# apply patches
quilt push -a
# patch shebangs of everything to allow binary packages to build
patchShebangs .
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
export SKIP_SUBMODULE_DEPS=1
export NODE_OPTIONS=--openssl-legacy-provider
# rebuild binary packages now that scripts have been patched
echo "----- NPM rebuild"
npm rebuild --prefer-offline
# Replicate ci/dev/postinstall.sh
echo "----- Replicate ci/dev/postinstall.sh"
yarn --cwd "./vendor" install --modules-folder modules --offline --ignore-scripts --frozen-lockfile
# remove all built-in extensions, as these are 3rd party extensions that
# get downloaded from vscode marketplace
jq --slurp '.[0] * .[1]' "./lib/vscode/product.json" <(
cat << EOF
{
"builtInExtensions": []
}
EOF
) | sponge ./lib/vscode/product.json
# disable automatic updates
sed -i '/update.mode/,/\}/{s/default:.*/default: "none",/g}' \
lib/vscode/src/vs/platform/update/common/update.config.contribution.ts
# Patch out remote download of nodejs from build script
patch -p1 -i ${./remove-node-download.patch}
# Fetch packages for vscode
find ./lib/vscode -name "yarn.lock" -printf "%h\n" | \
xargs -I {} yarn --cwd {} \
--frozen-lockfile --ignore-scripts --ignore-engines
# patch shebangs of everything to allow binary packages to build
patchShebangs .
${patchEsbuild "./lib/vscode/build" "0.12.6"}
${patchEsbuild "./lib/vscode/extensions" "0.11.23"}
'' + lib.optionalString stdenv.isDarwin ''
# use prebuilt binary for @parcel/watcher, which requires macOS SDK 10.13+
# (see issue #101229)
pushd ./lib/vscode/remote/node_modules/@parcel/watcher
mkdir -p ./build/Release
mv ./prebuilds/darwin-x64/node.napi.glibc.node ./build/Release/watcher.node
jq "del(.scripts) | .gypfile = false" ./package.json | sponge ./package.json
popd
'' + ''
# put ripgrep binary into bin, so postinstall does not try to download it
find -name ripgrep -type d \
-execdir mkdir -p {}/bin \; \
-execdir ln -s ${ripgrep}/bin/rg {}/bin/rg \;
# run postinstall scripts after patching
find ./lib/vscode \( -path "*/node_modules/*" -or -path "*/extensions/*" \) \
-and -type f -name "yarn.lock" -printf "%h\n" | \
xargs -I {} sh -c 'jq -e ".scripts.postinstall" {}/package.json >/dev/null && yarn --cwd {} postinstall --frozen-lockfile --offline || true'
# build code-server
yarn build
# build vscode
VERSION=${finalAttrs.version} yarn build:vscode
# inject version into package.json
jq --slurp '.[0] * .[1]' ./package.json <(
cat << EOF
{
"version": "${finalAttrs.version}"
}
EOF
) | sponge ./package.json
# create release
yarn release
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/libexec/code-server $out/bin
# copy release to libexec path
cp -R -T release "$out/libexec/code-server"
# install only production dependencies
yarn --offline --cwd "$out/libexec/code-server" --production
# create wrapper
makeWrapper "${nodejs}/bin/node" "$out/bin/code-server" \
--add-flags "$out/libexec/code-server/out/node/entry.js"
runHook postInstall
'';
passthru = {
prefetchYarnCache = lib.overrideDerivation finalAttrs.yarnCache (d: {
outputHash = lib.fakeSha256;
});
tests = {
inherit (nixosTests) code-server;
};
# vscode-with-extensions compatibility
executableName = "code-server";
longName = "Visual Studio Code Server";
};
meta = {
description = "Run VS Code on a remote server";
longDescription = ''
code-server is VS Code running on a remote server, accessible through the
browser.
'';
homepage = "https://github.com/coder/code-server";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ offline henkery code-asher ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
mainProgram = "code-server";
};
})

View File

@ -1,10 +0,0 @@
--- ./vendor/modules/code-oss-dev/node_modules/playwright/install.js
+++ ./vendor/modules/code-oss-dev/node_modules/playwright/install.js
@@ -14,6 +14,4 @@
* limitations under the License.
*/
-const { installDefaultBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
-
-installDefaultBrowsersForNpmInstall();
+process.stdout.write('Browser install disabled by Nix build script\n');

View File

@ -1,28 +0,0 @@
--- ./lib/vscode/build/gulpfile.reh.js
+++ ./lib/vscode/build/gulpfile.reh.js
@@ -268,9 +268,6 @@
.pipe(util.stripSourceMappingURL())
.pipe(jsFilter.restore);
- const nodePath = `.build/node/v${nodeVersion}/${platform}-${arch}`;
- const node = gulp.src(`${nodePath}/**`, { base: nodePath, dot: true });
-
let web = [];
if (type === 'reh-web') {
web = [
@@ -287,7 +284,6 @@
license,
sources,
deps,
- node,
...web
);
@@ -385,7 +381,6 @@
const destinationFolderName = `vscode-${type}${dashed(platform)}${dashed(arch)}`;
const serverTaskCI = task.define(`vscode-${type}${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series(
- gulp.task(`node-${platform}-${arch}`),
util.rimraf(path.join(BUILD_ROOT, destinationFolderName)),
packageTask(type, platform, arch, sourceFolderName, destinationFolderName)
));

View File

@ -2,7 +2,7 @@
{pkgs ? import ../../.. {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}:
let
nodeEnv = import ../../development/node-packages/node-env.nix {

View File

@ -152,6 +152,7 @@ mapAliases ({
clasp = clingo; # added 2022-12-22
claws-mail-gtk3 = claws-mail; # Added 2021-07-10
cntk = throw "'cntk' has been removed from nixpkgs, as it was broken and unmaintained"; # Added 2023-10-09
code-server = throw "'code-server' has been removed from nixpkgs, as it was depending on EOL Node.js and is unmaintained."; # Added 2023-10-30
codimd = hedgedoc; # Added 2020-11-29
inherit (libsForQt5.mauiPackages) communicator; # added 2022-05-17
compton = throw "'compton' has been renamed to/replaced by 'picom'"; # Converted to throw 2023-09-10
@ -427,6 +428,8 @@ mapAliases ({
keysmith = libsForQt5.kdeGear.keysmith; # Added 2021-07-14
kfctl = throw "kfctl is broken and has been archived by upstream" ; # Added 2023-08-21
kgx = gnome-console; # Added 2022-02-19
kibana7 = throw "Kibana 7.x has been removed from nixpkgs as it depends on an end of life Node.js version and received no maintenance in time."; # Added 2023-30-10
kibana = kibana7;
kicad-with-packages3d = throw "'kicad-with-packages3d' has been renamed to/replaced by 'kicad'"; # Converted to throw 2023-09-10
kio-admin = libsForQt5.kdeGear.kio-admin; # Added 2023-03-18
kodiGBM = kodi-gbm;
@ -622,10 +625,14 @@ mapAliases ({
nixopsUnstable = nixops_unstable; # Added 2022-03-03
nixosTest = testers.nixosTest; # Added 2022-05-05
nmap-unfree = nmap; # Added 2021-04-06
nodejs_14 = throw "nodejs_14 has been removed as it is EOL."; # Added 2023-10-30
nodejs-slim_14 = throw "nodejs-slim_14 has been removed as it is EOL."; # Added 2023-10-30
nodejs-14_x = nodejs_14; # Added 2022-11-06
nodejs-slim-14_x = nodejs-slim_14; # Added 2022-11-06
nodejs_16 = throw "nodejs_16 has been removed as it is EOL."; # Added 2023-10-30
nodejs-16_x = nodejs_16; # Added 2022-11-06
nodejs-16_x-openssl_1_1 = throw "nodejs-16_x-openssl_1_1 has been removed."; # Added 2023-02-04
nodejs-slim_16 = throw "nodejs-slim_16 has been removed as it is EOL."; # Added 2022-11-06
nodejs-slim-16_x = nodejs-slim_16; # Added 2022-11-06
nodejs-18_x = nodejs_18; # Added 2022-11-06
nodejs-slim-18_x = nodejs-slim_18; # Added 2022-11-06

View File

@ -9830,9 +9830,6 @@ with pkgs;
kluctl = callPackage ../applications/networking/cluster/kluctl { };
kibana7 = callPackage ../development/tools/misc/kibana/7.x.nix { };
kibana = kibana7;
kibi = callPackage ../applications/editors/kibi { };
kio-fuse = libsForQt5.callPackage ../tools/filesystems/kio-fuse { };
@ -10311,15 +10308,6 @@ with pkgs;
nodejs-slim = nodejs-slim_18;
corepack = hiPrio corepack_18;
nodejs_14 = callPackage ../development/web/nodejs/v14.nix { openssl = openssl_1_1; };
nodejs-slim_14 = callPackage ../development/web/nodejs/v14.nix {
openssl = openssl_1_1;
enableNpm = false;
};
nodejs_16 = callPackage ../development/web/nodejs/v16.nix { };
nodejs-slim_16 = callPackage ../development/web/nodejs/v16.nix { enableNpm = false; };
nodejs_18 = callPackage ../development/web/nodejs/v18.nix { };
nodejs-slim_18 = callPackage ../development/web/nodejs/v18.nix { enableNpm = false; };
corepack_18 = hiPrio (callPackage ../development/web/nodejs/corepack.nix { nodejs = nodejs_18; });
@ -36344,13 +36332,6 @@ with pkgs;
inherit (nodePackages) node-gyp;
};
code-server = callPackage ../servers/code-server {
nodejs = nodejs_16;
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa CoreServices Security;
inherit (darwin) cctools;
inherit (nodePackages) node-gyp;
};
vue = callPackage ../applications/misc/vue { };
vuze = callPackage ../applications/networking/p2p/vuze {