Skip to content

Commit

Permalink
build: updated node.js to v18
Browse files Browse the repository at this point in the history
This is needed for compatability with `js-db`

[ci skip]
  • Loading branch information
tegefaulkes committed Jul 10, 2023
1 parent 48adbca commit 93bcab7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 32 deletions.
2 changes: 1 addition & 1 deletion pkgs.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import (
let rev = "ce6aa13369b667ac2542593170993504932eb836"; in
let rev = "f294325aed382b66c7a188482101b0f336d1d7db"; in
builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"
)
6 changes: 3 additions & 3 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
name = "${utils.basename}-${version}-linux-${arch}";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
nativeBuildInputs = [ utils.nodejs ];
nativeBuildInputs = [ nodejs ];
PKG_CACHE_PATH = utils.pkgCachePath;
PKG_IGNORE_TAG = 1;
buildPhase = ''
Expand All @@ -29,7 +29,7 @@ let
name = "${utils.basename}-${version}-win-${arch}.exe";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
nativeBuildInputs = [ utils.nodejs ];
nativeBuildInputs = [ nodejs ];
PKG_CACHE_PATH = utils.pkgCachePath;
PKG_IGNORE_TAG = 1;
buildPhase = ''
Expand All @@ -50,7 +50,7 @@ let
name = "${utils.basename}-${version}-macos-${arch}";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
nativeBuildInputs = [ utils.nodejs ];
nativeBuildInputs = [ nodejs ];
PKG_CACHE_PATH = utils.pkgCachePath;
PKG_IGNORE_TAG = 1;
buildPhase = ''
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let
in
mkShell {
nativeBuildInputs = [
utils.nodejs
nodejs
shellcheck
grpc-tools
grpcurl
Expand Down
47 changes: 20 additions & 27 deletions utils.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{ runCommandNoCC
, linkFarm
, nix-gitignore
, nodejs-16_x
, nodejs
, node2nix
, pkgs
, lib
, fetchurl
, fetchFromGitHub
}:

rec {
# Fix nodejs version
nodejs = nodejs-16_x;
# This removes the org scoping
basename = builtins.baseNameOf node2nixDev.packageName;
# Filter source to only what's necessary for building
Expand All @@ -30,14 +29,6 @@ rec {
"/jest.config.js"
] ./.;
nodeVersion = builtins.elemAt (lib.versions.splitVersion nodejs.version) 0;
# Custom node2nix directly from GitHub
node2nixSrc = fetchFromGitHub {
owner = "svanderburg";
repo = "node2nix";
rev = "9377fe4a45274fab0c7faba4f7c43ffae8421dd2";
sha256 = "15zip9w9hivd1p6k82hh4zba02jj6q0g2f1i9b7rrn2hs70qdlai";
};
node2nix = (import "${node2nixSrc}/release.nix" {}).package.x86_64-linux;
node2nixDrv = dev: runCommandNoCC "node2nix" {} ''
mkdir $out
${node2nix}/bin/node2nix \
Expand Down Expand Up @@ -78,28 +69,29 @@ rec {
'';
});
pkgBuilds = {
"3.4" = {
"3.5" = {
"linux-x64" = fetchurl {
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.4/node-v16.15.0-linux-x64";
sha256 = "sR98InYftgwoXMU6I1Jt9+flVmMy06Xdgpi/lcudU9A=";
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.5/node-v18.15.0-linux-x64";
sha256 = "0glr88p9higdwsffg3l243kpixqcf1mb7fawq62rj9n7b275lwx4";
};
"win32-x64" = fetchurl {
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.4/node-v16.15.0-win-x64";
sha256 = "tH4L7ENiaBbVVNbVDSiRMayGpleNp91pFiCPNKiFqpc=";
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.5/node-v18.15.0-win-x64";
sha256 = "1d51w02m5jv7fgk3brkv3wizn1l75rai1zyq8m9vlm1za1gaha8p";
};
"macos-x64" = fetchurl {
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.4/node-v16.15.0-macos-x64";
sha256 = "PlOsskHRucHXPz9Ip2BMYNpJR+TTdlG77A0GMB4jNts=";
};
"macos-arm64" = fetchurl {
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.4/node-v16.15.0-macos-arm64";
sha256 = "VNCPKjPQjLhzyX8d/FJ/dvDQcA9Gv9YZ6Wf2EcDCARI=";
url = "https://github.com/vercel/pkg-fetch/releases/download/v3.5/node-v18.15.0-macos-x64";
sha256 = "1qcih9l3vncg05glhr45avcz2p5sqk7sp9776q4133xg88s09k0k";
};
# No build for v18.15.0 macos-arm64 build
# "macos-arm64" = fetchurl {
# url = "https://github.com/vercel/pkg-fetch/releases/download/v3.4/node-v16.15.0-macos-arm64";
# sha256 = "VNCPKjPQjLhzyX8d/FJ/dvDQcA9Gv9YZ6Wf2EcDCARI=";
# };
};
};
pkgCachePath =
let
pkgBuild = pkgBuilds."3.4";
pkgBuild = pkgBuilds."3.5";
fetchedName = n: builtins.replaceStrings ["node"] ["fetched"] n;
in
linkFarm "pkg-cache"
Expand All @@ -116,9 +108,10 @@ rec {
name = fetchedName pkgBuild.macos-x64.name;
path = pkgBuild.macos-x64;
}
{
name = fetchedName pkgBuild.macos-arm64.name;
path = pkgBuild.macos-arm64;
}
# No build for v18.15 macos-arm64 build
# {
# name = fetchedName pkgBuild.macos-arm64.name;
# path = pkgBuild.macos-arm64;
# }
];
}

0 comments on commit 93bcab7

Please sign in to comment.