improvements for final version of parcel2

This commit is contained in:
2021-10-31 18:33:03 +01:00
parent 9d103f5f34
commit b591d190d4
24 changed files with 9085 additions and 5522 deletions

View File

@@ -1,21 +1,7 @@
{ pkgs }:
{ pkgs, nix-filter }:
with pkgs;
with pkgs; with nix-filter.lib;
let
yarnFilter = p: t: builtins.any (x: baseNameOf p == x) [
"package.json"
"yarn.lock"
];
yarnSrc = lib.cleanSourceWith {
filter = yarnFilter;
src = ./.;
};
in
rec {
shell = buildEnv { name = "homepage-devshell"; paths = homepage.buildInputs; };
@@ -25,25 +11,50 @@ rec {
sha256 = "sha256-wnw/eK+hqawpLbqC+sA65EF7FBz/Q8zvSJfb70dVo4o=";
};
yarnPkgs = yarn2nix-moretea.mkYarnPackage {
src = yarnSrc;
publishBinsFor = [ "parcel" ];
pkgConfig.lmdb-store = {
buildInputs = [ nodePackages.node-gyp python3 pkgconfig ];
postInstall = ''
node-gyp --nodedir=${nodeHeaders} rebuild
'';
};
};
yarnPkgs = (pkgs.callPackage ./yarn-project.nix
{
nodejs = pkgs.nodejs-14_x;
}
{
src = filter {
root = ./.;
include = [
"package.json"
"yarn.lock"
".yarnrc.yml"
(inDirectory ".yarn")
];
};
}).overrideAttrs (old: {
buildInputs = old.buildInputs ++ [
pkgs.vips
pkgs.python3
pkgs.pkgconfig
pkgs.inotify-tools
pkgs.nodePackages.node-gyp
];
});
homepage = stdenv.mkDerivation {
name = "Homepage";
src = ./.;
src = filter {
root = ./.;
include = [
".parcelrc"
".yarnrc.yml"
"elm.json"
"package.json"
"yarn.lock"
(inDirectory ".yarn")
(inDirectory "src")
];
};
buildInputs = with elmPackages; [
elm
elm-format
elm2nix
yarnPkgs
yarn
];
patchPhase = ''
ln -sf ${yarnPkgs}/libexec/*/node_modules .
@@ -55,7 +66,14 @@ rec {
};
installPhase = ''
mkdir $out
parcel build --dist-dir $out index.html --no-source-maps --no-cache
yarn parcel build --dist-dir $out src/index.html --no-source-maps --no-cache
'';
};
homepage-dev = homepage // {
installPhase = ''
mkdir $out
yarn parcel build --dist-dir $out src/index.html --no-cache --no-optimize
'';
};
}