summaryrefslogtreecommitdiff
path: root/Biz.nix
blob: 66ed4fbbc9c3ec65c5e8c0d147a4afce8ba38938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env run.sh
# nunya
#
# To build the NixOS system:
#   1. First build packages: nix-build Biz/Packages.nix
#   2. Then build OS with packages: nix-build Biz.nix --arg packages "import ./Biz/Packages.nix {}"
#
# Or use the wrapper: Omni/Ide/run.sh Biz.nix
{
  bild,
  packages ? import ./Biz/Packages.nix {inherit bild;},
  ...
}:
# This is the biz hosting service. Currently it defines a base OS similar to
# Omni/Cloud.nix et al and starts each Biz/* thing as a systemd service. A
# better solution might be to define each Biz/* thing as a container, and then
# wire them together as necessary here, but I don't know how that works so I'll
# just stick to this method for now.
bild.os {
  imports = [
    ./Omni/Cloud/Hardware.nix
    ./Omni/Os/Base.nix
    ./Omni/Packages.nix
    ./Omni/Users.nix
    ./Omni/Deploy/Deployer.nix
  ];
  networking.hostName = "biz";
  networking.domain = "podcastitlater.bensima.com";
  time.timeZone = "America/New_York";

  # Mini-PaaS deployer service manages all application services
  # via manifest.json in S3. Services like podcastitlater-web,
  # podcastitlater-worker are deployed dynamically without NixOS rebuild.
  services.deployer = {
    enable = true;
    package = packages.biz-deployer;
    manifestPackage = packages.deploy-manifest;
  };

  # GoatCounter analytics - SQLite backend
  services.goatcounter = {
    enable = true;
    address = "127.0.0.1";
    port = 8081;
    proxy = true; # Running behind Caddy reverse proxy
  };
}