Skip to content

Instantly share code, notes, and snippets.

@dmjio
Created June 10, 2020 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmjio/ec5b96b2fc287c1ac01b7bfb9b7b8842 to your computer and use it in GitHub Desktop.
Save dmjio/ec5b96b2fc287c1ac01b7bfb9b7b8842 to your computer and use it in GitHub Desktop.
pkgs:
with pkgs;
let
yarn2nix = import (fetchFromGitHub {
owner = "moretea";
repo = "yarn2nix";
rev = "9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae";
sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7";
}) {
inherit pkgs yarn nodejs;
};
in
yarn2nix.mkYarnPackage rec {
name = "appstack";
src = lib.cleanSourceWith {
src = ../../../app/leaf/web/theme;
filter = name: type: with lib;
let baseName = baseNameOf (toString name);
in (
(hasSuffix ".js" baseName) ||
(hasSuffix ".scss" baseName) ||
(baseName == "package.json") ||
(baseName == "yarn.lock") ||
(type == "directory" && baseName != "node_modules")
);
};
packageJSON = "${src}/package.json";
yarnLock = "${src}/yarn.lock";
pkgConfig = {
node-sass = {
buildInputs = with stdenv;
[ python ] ++ lib.optional isLinux libtool;
postInstall = with stdenv;
lib.optionalString isDarwin ''
export PATH=$PATH:"${darwin.xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
'' + ''
export LIBSASS_EXT="no";
yarn --offline run build
rm build/config.gypi
'';
};
};
installPhase = ''
mkdir home
mkdir -p $out/libexec/appstack/deps/appstack
export HOME=$(realpath home)
mv deps/appstack/node_modules node_modules_old
export PATH=$PATH:$(realpath node_modules_old)/.bin
mkdir -p deps/appstack/node_modules
yarn --offline run build
cd deps/appstack
cp package.json $out/libexec/appstack/deps/appstack
mv dist $out
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment