2021-01-24 15:56:45 +01:00
|
|
|
{
|
|
|
|
buildPythonPackage,
|
|
|
|
flask,
|
|
|
|
flask_sqlalchemy,
|
|
|
|
lib,
|
|
|
|
libsass,
|
|
|
|
mkYarnModules,
|
|
|
|
nodejs,
|
|
|
|
pkgconfig,
|
|
|
|
pkgs,
|
|
|
|
psycopg2,
|
|
|
|
python2,
|
|
|
|
python3,
|
|
|
|
stdenv,
|
2021-01-28 16:43:30 +01:00
|
|
|
flask-excel,
|
|
|
|
pyexcel-xlsx,
|
2021-01-24 15:56:45 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
src = fetchGit {
|
|
|
|
url = "https://git.clerie.de/clerie/wetter.git";
|
2021-01-28 16:41:49 +01:00
|
|
|
rev = "bb503828098717825c389fd6f450b395a02dcc6a";
|
2021-01-24 15:56:45 +01:00
|
|
|
};
|
|
|
|
pname = "wetter";
|
|
|
|
version = "0.0.1";
|
|
|
|
|
|
|
|
packageJSON = src + "/package.json";
|
|
|
|
yarnLock = src + "/yarn.lock";
|
|
|
|
|
|
|
|
modules = mkYarnModules {
|
|
|
|
pname = "${pname}-modules";
|
|
|
|
name = "${pname}-modules-${version}";
|
|
|
|
inherit version packageJSON yarnLock;
|
|
|
|
|
|
|
|
/* build native node-sass extensions */
|
|
|
|
pkgConfig.node-sass = {
|
|
|
|
buildInputs = [ python2 libsass pkgconfig ];
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $HOME/.node-gyp/${nodejs.version}
|
|
|
|
echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
|
|
|
|
ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
|
|
|
|
LIBSASS_EXT=auto yarn --offline run build
|
|
|
|
rm build/config.gypi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
assets = stdenv.mkDerivation {
|
|
|
|
inherit src pname version;
|
|
|
|
|
|
|
|
NODE_ENV = "production";
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
ln -s ${modules}/node_modules
|
|
|
|
node_modules/.bin/rollup -c
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
cp -r wetter/static/bundle $out
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in buildPythonPackage rec {
|
|
|
|
inherit src pname version;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
flask
|
|
|
|
flask_sqlalchemy
|
|
|
|
psycopg2
|
2021-01-28 16:43:30 +01:00
|
|
|
flask-excel
|
|
|
|
pyexcel-xlsx
|
2021-01-24 15:56:45 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/${python3.sitePackages}/wetter/static
|
|
|
|
cp -r ${assets} $out/${python3.sitePackages}/wetter/static/bundle
|
|
|
|
cp -r wetter/templates $out/${python3.sitePackages}/wetter/templates
|
|
|
|
'';
|
|
|
|
|
2021-01-28 16:42:47 +01:00
|
|
|
doCheck = false;
|
2021-01-24 15:56:45 +01:00
|
|
|
}
|