Clean up and fully fix the build #4
19
flake.lock
19
flake.lock
|
@ -31,10 +31,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-unstable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1617899217,
|
||||||
|
"narHash": "sha256-gd5JHH7IkeoIQ/oiGZSqDpGdGt7DMRJTQ8JiD8+hdOQ=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "9e377a6ce42dccd9b624ae4ce8f978dc892ba0e2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,12 +3,14 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
|
||||||
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }@inputs:
|
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils }@inputs:
|
||||||
flake-utils.lib.simpleFlake {
|
flake-utils.lib.simpleFlake {
|
||||||
inherit self nixpkgs;
|
inherit self;
|
||||||
|
nixpkgs = nixpkgs-unstable;
|
||||||
name = "tlaternet-templates";
|
name = "tlaternet-templates";
|
||||||
|
|
||||||
overlay = final: prev: {
|
overlay = final: prev: {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# This file has been generated by node2nix 1.8.0. Do not edit!
|
# This file has been generated by node2nix 1.9.0. Do not edit!
|
||||||
|
|
||||||
{pkgs ? import <nixpkgs> {
|
{pkgs ? import <nixpkgs> {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
nodeEnv = import ./node-env.nix {
|
nodeEnv = import ./node-env.nix {
|
||||||
inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile;
|
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
|
||||||
inherit nodejs;
|
inherit pkgs nodejs;
|
||||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
import ./node-packages.nix {
|
import ./node-packages.nix {
|
||||||
inherit (pkgs) fetchurl fetchgit;
|
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
||||||
inherit nodeEnv;
|
inherit nodeEnv;
|
||||||
}
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
# This file originates from node2nix
|
# This file originates from node2nix
|
||||||
|
|
||||||
{stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile}:
|
{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
# Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master
|
||||||
|
utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux;
|
||||||
|
|
||||||
python = if nodejs ? python then nodejs.python else python2;
|
python = if nodejs ? python then nodejs.python else python2;
|
||||||
|
|
||||||
# Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
|
# Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
|
||||||
|
@ -38,8 +41,8 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
includeDependencies = {dependencies}:
|
includeDependencies = {dependencies}:
|
||||||
stdenv.lib.optionalString (dependencies != [])
|
lib.optionalString (dependencies != [])
|
||||||
(stdenv.lib.concatMapStrings (dependency:
|
(lib.concatMapStrings (dependency:
|
||||||
''
|
''
|
||||||
# Bundle the dependencies of the package
|
# Bundle the dependencies of the package
|
||||||
mkdir -p node_modules
|
mkdir -p node_modules
|
||||||
|
@ -100,7 +103,7 @@ let
|
||||||
cd "$DIR/${packageName}"
|
cd "$DIR/${packageName}"
|
||||||
${includeDependencies { inherit dependencies; }}
|
${includeDependencies { inherit dependencies; }}
|
||||||
cd ..
|
cd ..
|
||||||
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pinpointDependencies = {dependencies, production}:
|
pinpointDependencies = {dependencies, production}:
|
||||||
|
@ -161,12 +164,12 @@ let
|
||||||
''
|
''
|
||||||
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
|
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (dependencies != [])
|
${lib.optionalString (dependencies != [])
|
||||||
''
|
''
|
||||||
if [ -d node_modules ]
|
if [ -d node_modules ]
|
||||||
then
|
then
|
||||||
cd node_modules
|
cd node_modules
|
||||||
${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
|
${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
@ -183,7 +186,7 @@ let
|
||||||
cd "${packageName}"
|
cd "${packageName}"
|
||||||
${pinpointDependencies { inherit dependencies production; }}
|
${pinpointDependencies { inherit dependencies production; }}
|
||||||
cd ..
|
cd ..
|
||||||
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -242,8 +245,8 @@ let
|
||||||
if(fs.existsSync("./package-lock.json")) {
|
if(fs.existsSync("./package-lock.json")) {
|
||||||
var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));
|
var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));
|
||||||
|
|
||||||
if(packageLock.lockfileVersion !== 1) {
|
if(![1, 2].includes(packageLock.lockfileVersion)) {
|
||||||
process.stderr.write("Sorry, I only understand lock file version 1!\n");
|
process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,8 +347,8 @@ let
|
||||||
cd "${packageName}"
|
cd "${packageName}"
|
||||||
runHook preRebuild
|
runHook preRebuild
|
||||||
|
|
||||||
${stdenv.lib.optionalString bypassCache ''
|
${lib.optionalString bypassCache ''
|
||||||
${stdenv.lib.optionalString reconstructLock ''
|
${lib.optionalString reconstructLock ''
|
||||||
if [ -f package-lock.json ]
|
if [ -f package-lock.json ]
|
||||||
then
|
then
|
||||||
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
|
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
|
||||||
|
@ -361,14 +364,14 @@ let
|
||||||
node ${addIntegrityFieldsScript}
|
node ${addIntegrityFieldsScript}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
|
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
|
||||||
|
|
||||||
if [ "''${dontNpmInstall-}" != "1" ]
|
if [ "''${dontNpmInstall-}" != "1" ]
|
||||||
then
|
then
|
||||||
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
|
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
|
||||||
rm -f npm-shrinkwrap.json
|
rm -f npm-shrinkwrap.json
|
||||||
|
|
||||||
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
|
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -396,8 +399,8 @@ let
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "node_${name}-${version}";
|
name = "node_${name}-${version}";
|
||||||
buildInputs = [ tarWrapper python nodejs ]
|
buildInputs = [ tarWrapper python nodejs ]
|
||||||
++ stdenv.lib.optional (stdenv.isLinux) utillinux
|
++ lib.optional (stdenv.isLinux) utillinux
|
||||||
++ stdenv.lib.optional (stdenv.isDarwin) libtool
|
++ lib.optional (stdenv.isDarwin) libtool
|
||||||
++ buildInputs;
|
++ buildInputs;
|
||||||
|
|
||||||
inherit nodejs;
|
inherit nodejs;
|
||||||
|
@ -445,8 +448,8 @@ let
|
||||||
'';
|
'';
|
||||||
} // extraArgs);
|
} // extraArgs);
|
||||||
|
|
||||||
# Builds a development shell
|
# Builds a node environment (a node_modules folder and a set of binaries)
|
||||||
buildNodeShell =
|
buildNodeDependencies =
|
||||||
{ name
|
{ name
|
||||||
, packageName
|
, packageName
|
||||||
, version
|
, version
|
||||||
|
@ -465,13 +468,13 @@ let
|
||||||
|
|
||||||
let
|
let
|
||||||
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
|
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
|
||||||
|
in
|
||||||
nodeDependencies = stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "node-dependencies-${name}-${version}";
|
name = "node-dependencies-${name}-${version}";
|
||||||
|
|
||||||
buildInputs = [ tarWrapper python nodejs ]
|
buildInputs = [ tarWrapper python nodejs ]
|
||||||
++ stdenv.lib.optional (stdenv.isLinux) utillinux
|
++ lib.optional (stdenv.isLinux) utillinux
|
||||||
++ stdenv.lib.optional (stdenv.isDarwin) libtool
|
++ lib.optional (stdenv.isDarwin) libtool
|
||||||
++ buildInputs;
|
++ buildInputs;
|
||||||
|
|
||||||
inherit dontStrip; # Stripping may fail a build for some package deployments
|
inherit dontStrip; # Stripping may fail a build for some package deployments
|
||||||
|
@ -491,7 +494,7 @@ let
|
||||||
# Create fake package.json to make the npm commands work properly
|
# Create fake package.json to make the npm commands work properly
|
||||||
cp ${src}/package.json .
|
cp ${src}/package.json .
|
||||||
chmod 644 package.json
|
chmod 644 package.json
|
||||||
${stdenv.lib.optionalString bypassCache ''
|
${lib.optionalString bypassCache ''
|
||||||
if [ -f ${src}/package-lock.json ]
|
if [ -f ${src}/package-lock.json ]
|
||||||
then
|
then
|
||||||
cp ${src}/package-lock.json .
|
cp ${src}/package-lock.json .
|
||||||
|
@ -500,23 +503,44 @@ let
|
||||||
|
|
||||||
# Go to the parent folder to make sure that all packages are pinpointed
|
# Go to the parent folder to make sure that all packages are pinpointed
|
||||||
cd ..
|
cd ..
|
||||||
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
||||||
|
|
||||||
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
|
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
|
||||||
|
|
||||||
# Expose the executables that were installed
|
# Expose the executables that were installed
|
||||||
cd ..
|
cd ..
|
||||||
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
||||||
|
|
||||||
mv ${packageName} lib
|
mv ${packageName} lib
|
||||||
ln -s $out/lib/node_modules/.bin $out/bin
|
ln -s $out/lib/node_modules/.bin $out/bin
|
||||||
'';
|
'';
|
||||||
} // extraArgs);
|
} // extraArgs);
|
||||||
|
|
||||||
|
# Builds a development shell
|
||||||
|
buildNodeShell =
|
||||||
|
{ name
|
||||||
|
, packageName
|
||||||
|
, version
|
||||||
|
, src
|
||||||
|
, dependencies ? []
|
||||||
|
, buildInputs ? []
|
||||||
|
, production ? true
|
||||||
|
, npmFlags ? ""
|
||||||
|
, dontNpmInstall ? false
|
||||||
|
, bypassCache ? false
|
||||||
|
, reconstructLock ? false
|
||||||
|
, dontStrip ? true
|
||||||
|
, unpackPhase ? "true"
|
||||||
|
, buildPhase ? "true"
|
||||||
|
, ... }@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
nodeDependencies = buildNodeDependencies args;
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "node-shell-${name}-${version}";
|
name = "node-shell-${name}-${version}";
|
||||||
|
|
||||||
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
|
buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cat > $out/bin/shell <<EOF
|
cat > $out/bin/shell <<EOF
|
||||||
|
@ -529,14 +553,15 @@ let
|
||||||
|
|
||||||
# Provide the dependencies in a development shell through the NODE_PATH environment variable
|
# Provide the dependencies in a development shell through the NODE_PATH environment variable
|
||||||
inherit nodeDependencies;
|
inherit nodeDependencies;
|
||||||
shellHook = stdenv.lib.optionalString (dependencies != []) ''
|
shellHook = lib.optionalString (dependencies != []) ''
|
||||||
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
||||||
export PATH="${nodeDependencies}/bin:$PATH"
|
export PATH="${nodeDependencies}/bin:$PATH"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist;
|
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
|
||||||
buildNodePackage = stdenv.lib.makeOverridable buildNodePackage;
|
buildNodePackage = lib.makeOverridable buildNodePackage;
|
||||||
buildNodeShell = stdenv.lib.makeOverridable buildNodeShell;
|
buildNodeDependencies = lib.makeOverridable buildNodeDependencies;
|
||||||
|
buildNodeShell = lib.makeOverridable buildNodeShell;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,7 +15,5 @@ in nodePackages // {
|
||||||
vips
|
vips
|
||||||
glib
|
glib
|
||||||
];
|
];
|
||||||
|
|
||||||
npmFlags = "--ignore-scripts";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
895
package-lock.json
generated
895
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -42,11 +42,7 @@
|
||||||
"typescript": "^4.2.4",
|
"typescript": "^4.2.4",
|
||||||
"typescript-language-server": "^0.4.0"
|
"typescript-language-server": "^0.4.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
|
||||||
"sharp": "0.26.3"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx npm-force-resolutions",
|
|
||||||
"build": "parcel build --no-autoinstall src/index.html",
|
"build": "parcel build --no-autoinstall src/index.html",
|
||||||
"serve": "parcel serve --no-autoinstall src/index.html",
|
"serve": "parcel serve --no-autoinstall src/index.html",
|
||||||
"watch": "parcel watch --no-autoinstall src/index.html",
|
"watch": "parcel watch --no-autoinstall src/index.html",
|
||||||
|
|
Reference in a new issue