{ name = "bookwyrm-can-start"; nodes.bookwyrm = { config, pkgs, ... }: { imports = [ ../modules/bookwyrm.nix ]; services.bookwyrm = { enable = true; settings = { DOMAIN = "localhost"; DEBUG = false; USE_HTTPS = true; EMAIL = "your@email.here"; PGPORT = 5432; POSTGRES_USER = "bookwyrm"; POSTGRES_DB = "bookwyrm"; POSTGRES_HOST = "localhost"; REDIS_ACTIVITY_HOST = "localhost"; REDIS_ACTIVITY_PORT = 6379; REDIS_BROKER_HOST = "localhost"; REDIS_BROKER_PORT = 6379; EMAIL_HOST = "smtp.example.com"; EMAIL_PORT = 587; EMAIL_HOST_USER = "mail@example.org"; EMAIL_HOST_PASSWORD = "blub"; MEDIA_ROOT = "/var/lib/bookwyrm/images"; }; setupNginx = true; environmentFile = pkgs.writeText ".env" '' SECRET_KEY=fnord2 ''; }; services.redis.servers."bookwyrm" = { enable = true; port = 6379; }; services.postgresql = { enable = true; ensureDatabases = [ "bookwyrm" ]; ensureUsers = [{ name = "bookwyrm"; ensureDBOwnership = true; }]; authentication = '' local all all trust host all all 127.0.0.1/32 trust host all all ::1/127 trust ''; }; }; testScript = '' machine.start() machine.wait_for_unit("bookwyrm.service") machine.wait_for_open_port(8000) # does bookwyrm work? machine.succeed("curl -f http://localhost") # does nginx serve static files? machine.succeed("curl -f http://localhost/static/css/themes/bookwyrm-light.css") # does the manage.py wrapper work? machine.succeed("bookwyrm-manage.py admin_code") ''; }