diff --git a/.gitmodules b/.gitmodules index 0ac1af0..1fdced1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "wetten"] path = wetten url = ssh://gogs@git.ingolf-wagner.de:443/palo/wetten.git +[submodule "submodules/property"] + path = submodules/property + url = ssh://gogs@git.ingolf-wagner.de:443/palo/property_crawlers.git diff --git a/configs/workhorse/configuration.nix b/configs/workhorse/configuration.nix index 00ec07c..bb14ddc 100644 --- a/configs/workhorse/configuration.nix +++ b/configs/workhorse/configuration.nix @@ -28,6 +28,7 @@ ./metabase.nix ./jupyter.nix ./mysql.nix + ./property.nix ]; # todo: add this to each file instead summing that here diff --git a/configs/workhorse/mysql.nix b/configs/workhorse/mysql.nix index 9b965aa..6d0e136 100644 --- a/configs/workhorse/mysql.nix +++ b/configs/workhorse/mysql.nix @@ -11,14 +11,10 @@ services.mysqlBackup = { enable = true; - databases = [ - "property" - ]; + databases = [ "property" ]; user = "root"; }; - backup.dirs = [ - config.services.mysqlBackup.location - ]; + backup.dirs = [ config.services.mysqlBackup.location ]; } diff --git a/configs/workhorse/property.nix b/configs/workhorse/property.nix new file mode 100644 index 0000000..4665490 --- /dev/null +++ b/configs/workhorse/property.nix @@ -0,0 +1,43 @@ +{ lib, pkgs, config, ... }: +{ + + users.users.property = {}; + + systemd.services.property = { + enable = true; + wantedBy = [ "multi-user.target" ]; + path = [ + (pkgs.python3.withPackages (ps: with ps; [ + flask + selenium + beautifulsoup4 + urllib3 + sqlalchemy + mysqlclient + pytest + dateparser + geopy + nltk + click + ])) + ]; + + serviceConfig = { User = "property"; }; + script = '' + FLASK_APP=${}/server.py \ + FLASK_RUN_PORT=7888 \ + flask run --host 0.0.0.0 \ + "$@" + ''; + }; + + services.nginx = { + enable = true; + virtualHosts = { + "property.workhorse.private" = { + locations."/" = { proxyPass = "http://localhost:7888"; }; + }; + }; + }; + +} diff --git a/shell.nix b/shell.nix index ecfd5d3..ff994d6 100644 --- a/shell.nix +++ b/shell.nix @@ -38,11 +38,19 @@ let }; }; - system = name: { + system = name: + let + exclusive = name: + if name == "workhorse" then { + property.file = toString ./submodules/property; + } else { + }; + in + { system.file = toString ./system; configs.file = toString ./configs; nixos-config.symlink = "configs/${name}/configuration.nix"; - }; + } // (exclusive name); desktopSecrets = { desktop_secrets.pass = { @@ -119,10 +127,6 @@ let url = "https://github.com/mrVanDalo/nixos-configs.git"; ref = "76260ad60cd99d40ab25df1400b0663d48e736db"; }; - - # enable only on workhorse - # wetten.file = toString ./wetten; - }; }; diff --git a/submodules/property b/submodules/property new file mode 160000 index 0000000..f2ddb4a --- /dev/null +++ b/submodules/property @@ -0,0 +1 @@ +Subproject commit f2ddb4affcca8e348cd9d6cd457e25c9fe2caed4 diff --git a/system/desktop/packages.nix b/system/desktop/packages.nix index 3171764..b2ed74d 100644 --- a/system/desktop/packages.nix +++ b/system/desktop/packages.nix @@ -234,7 +234,7 @@ in { }; })) - navi + dino # jabber client nixos-generators shellcheck