Compare commits
7 Commits
901cb8c811
...
43164566fe
Author | SHA1 | Date | |
---|---|---|---|
43164566fe | |||
28ffcd58fb | |||
a027c8cb49 | |||
dc199ae8a5 | |||
a66af936e5 | |||
bbc2046de7 | |||
c79ce0eec1 |
@ -14,6 +14,7 @@
|
||||
./public.nix
|
||||
./radicale.nix
|
||||
./reichartstrasse.nix
|
||||
./wetter.nix
|
||||
./znc.nix
|
||||
];
|
||||
|
||||
|
79
hosts/web-2/wetter.nix
Normal file
79
hosts/web-2/wetter.nix
Normal file
@ -0,0 +1,79 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
configFile = pkgs.writeText "wetter.cfg" ''
|
||||
SQLALCHEMY_DATABASE_URI="postgresql://wetter_web@/wetter?host=/run/postgresql"
|
||||
'';
|
||||
|
||||
in {
|
||||
users.users.wetter = {
|
||||
description = "Wetter Service";
|
||||
group = "wetter";
|
||||
home = "/var/lib/wetter/";
|
||||
useDefaultShell = true;
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups.wetter = {};
|
||||
|
||||
users.users.wetter_web = {
|
||||
description = "Wetter Web Service";
|
||||
group = "wetter_web";
|
||||
home = "/var/lib/wetter/";
|
||||
useDefaultShell = true;
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups.wetter_web = {};
|
||||
|
||||
services.postgresql = {
|
||||
ensureDatabases = [ "wetter" ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "wetter";
|
||||
ensurePermissions = {
|
||||
"DATABASE wetter" = "ALL PRIVILEGES";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "wetter_scraper";
|
||||
ensurePermissions = {
|
||||
"DATABASE wetter" = "CONNECT";
|
||||
"SCHEMA public" = "USAGE";
|
||||
"ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "wetter_web";
|
||||
ensurePermissions = {
|
||||
"DATABASE wetter" = "CONNECT";
|
||||
"SCHEMA public" = "USAGE";
|
||||
"ALL TABLES IN SCHEMA public" = "SELECT";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.wetter = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
RuntimeDirectory = "wetter";
|
||||
StateDirectory = "wetter";
|
||||
User = "wetter_web";
|
||||
Group = "wetter_web";
|
||||
};
|
||||
environment = {
|
||||
WETTER_SETTINGS = "${configFile}";
|
||||
};
|
||||
script = "gunicorn -w 4 -b [::1]:8234 wetter:app";
|
||||
path = with pkgs; [ (python38.withPackages (ps: [ ps.gunicorn wetter ])) ];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts = {
|
||||
"wetter.clerie.de" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://[::1]:8234";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
17
pkgs/flask-excel/default.nix
Normal file
17
pkgs/flask-excel/default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ buildPythonPackage, fetchPypi, pyexcel-webio, flask }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Flask-Excel";
|
||||
version = "0.0.7";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "b82ddfe6319ecf2f796ada9966737ac8eaf9a99d6bce773f8acdc08acd7e9fae";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pyexcel-webio flask
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
self: super: {
|
||||
anycast_healthchecker = self.python3.pkgs.callPackage ./anycast_healthchecker {};
|
||||
flask-excel = self.python3.pkgs.callPackage ./flask-excel {};
|
||||
pyexcel-xlsx = self.python3.pkgs.callPackage ./pyexcel-xlsx {};
|
||||
pyexcel-webio = self.python3.pkgs.callPackage ./pyexcel-webio {};
|
||||
wetter = self.python3.pkgs.callPackage ./wetter {
|
||||
inherit (self) python2 pkgconfig libsass;
|
||||
};
|
||||
|
17
pkgs/pyexcel-webio/default.nix
Normal file
17
pkgs/pyexcel-webio/default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ buildPythonPackage, fetchPypi, pyexcel }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pyexcel-webio";
|
||||
version = "0.1.4";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "039538f1b35351f1632891dde29ef4d7fba744e217678ebb5a501336e28ca265";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pyexcel
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
}
|
17
pkgs/pyexcel-xlsx/default.nix
Normal file
17
pkgs/pyexcel-xlsx/default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ buildPythonPackage, fetchPypi, openpyxl, pyexcel-io }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pyexcel-xlsx";
|
||||
version = "0.6.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "55754f764252461aca6871db203f4bd1370ec877828e305e6be1de5f9aa6a79d";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
openpyxl pyexcel-io
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
}
|
@ -12,12 +12,14 @@
|
||||
python2,
|
||||
python3,
|
||||
stdenv,
|
||||
flask-excel,
|
||||
pyexcel-xlsx,
|
||||
}:
|
||||
|
||||
let
|
||||
src = fetchGit {
|
||||
url = "https://git.clerie.de/clerie/wetter.git";
|
||||
rev = "b7134dbc0fcf44623e5adb14d1c84d07f7872844";
|
||||
rev = "bb503828098717825c389fd6f450b395a02dcc6a";
|
||||
};
|
||||
pname = "wetter";
|
||||
version = "0.0.1";
|
||||
@ -69,6 +71,8 @@ in buildPythonPackage rec {
|
||||
flask
|
||||
flask_sqlalchemy
|
||||
psycopg2
|
||||
flask-excel
|
||||
pyexcel-xlsx
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
@ -77,5 +81,5 @@ in buildPythonPackage rec {
|
||||
cp -r wetter/templates $out/${python3.sitePackages}/wetter/templates
|
||||
'';
|
||||
|
||||
checkPhase = ":";
|
||||
doCheck = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user