1
0
nixfiles/pkgs/wetter/default.nix

84 lines
1.7 KiB
Nix
Raw Normal View History

2021-01-24 15:56:45 +01:00
{
2022-10-17 23:03:09 +02:00
pkgs,
2021-01-24 15:56:45 +01:00
buildPythonPackage,
flask,
flask_sqlalchemy,
lib,
libsass,
2022-02-26 13:15:30 +01:00
yarn2nix-moretea,
2021-01-24 15:56:45 +01:00
nodejs,
2022-10-02 16:50:31 +02:00
pkg-config,
2021-01-24 15:56:45 +01:00
psycopg2,
python3,
stdenv,
flask-excel,
pyexcel-xlsx,
2021-01-24 15:56:45 +01:00
}:
let
2022-10-17 23:03:09 +02:00
src = pkgs.fetchgit {
2021-01-24 15:56:45 +01:00
url = "https://git.clerie.de/clerie/wetter.git";
2022-03-05 13:43:24 +01:00
rev = "3193c6d507af5d6f5d62c23046b7fbf0c638ddb4";
2022-10-17 23:03:09 +02:00
sha256 = "sha256-ouUmmw020jKg/SRlYhGBFRw/atxW+atQ1JSTFQNi5iw=";
2021-01-24 15:56:45 +01:00
};
pname = "wetter";
version = "0.0.1";
packageJSON = src + "/package.json";
yarnLock = src + "/yarn.lock";
2022-02-26 13:15:30 +01:00
modules = yarn2nix-moretea.mkYarnModules {
2021-01-24 15:56:45 +01:00
pname = "${pname}-modules";
name = "${pname}-modules-${version}";
inherit version packageJSON yarnLock;
/* build native node-sass extensions */
pkgConfig.node-sass = {
2022-10-02 16:50:31 +02:00
buildInputs = [ python3 libsass pkg-config ];
2021-01-24 15:56:45 +01:00
postInstall = ''
2022-02-26 13:15:30 +01:00
export npm_config_nodedir=${nodejs}
2021-01-24 15:56:45 +01:00
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
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
'';
doCheck = false;
2021-01-24 15:56:45 +01:00
}