summaryrefslogtreecommitdiff
path: root/default.nix
blob: 41a1f0b13ed18fc10a512a8d28b4b7e713c42b42 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
let
  nixpkgs-tar = builtins.fetchTarball (import ./nixpkgs.nix);
  nixpkgs = import "${nixpkgs-tar}" {};
  nixos = import "${nixpkgs-tar}/nixos";
  # TODO(bsima): buildNixOS should be split into multiple functions that each
  # return one thing, instead of a single function that returns multiple things
  buildOS = import ./Com/Simatime/buildOS.nix nixos;
  buildGhc = import ./Com/Simatime/buildGhc.nix nixpkgs;
  buildGhcjs = import ./Com/Simatime/buildGhcjs.nix nixpkgs;
  nixos-mailserver = let ver = "v2.3.0"; in builtins.fetchTarball {
    url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${ver}/nixos-mailserver-${ver}.tar.gz";
    sha256 = "0lpz08qviccvpfws2nm83n7m2r8add2wvfg9bljx9yxx8107r919";
  };
in rec {
  # Cloud infrastructure, always online. Mostly for messaging-related
  # stuff.
  #
  Com.Simatime.Cloud = buildOS {
    enableVpn = true;
    ipAddress = "159.89.128.69";
    vpnRsaPrivateKeyFile = "/etc/tinc/rsa_key.priv";
    vpnEd25519PrivateKeyFile = "/etc/tinc/ed25519_key.priv";
    configuration = {
      imports = [
        ./Com/Simatime/packages.nix
        ./Com/Simatime/users.nix
        ./Com/Simatime/Cloud/chat.nix
        ./Com/Simatime/Cloud/git.nix
        ./Com/Simatime/Cloud/hardware.nix
        ./Com/Simatime/Cloud/mail.nix
        ./Com/Simatime/Cloud/networking.nix
        ./Com/Simatime/Cloud/web.nix
        ./Com/Simatime/Cloud/znc.nix
        nixos-mailserver
      ];
      networking.hostName = "simatime";
      networking.domain = "simatime.com";
    };
  };
  # Dev machine for work and building stuff.
  #
  Com.Simatime.Dev = buildOS {
    enableVpn = true;
    ipAddress = "69.181.254.154";
    configuration = {
      imports = [
        ./Com/Simatime/packages.nix
        ./Com/Simatime/users.nix
        ./Com/Simatime/Dev/configuration.nix
        ./Com/Simatime/Dev/hardware.nix
      ];
      networking.hostName = "lithium";
      networking.domain = "dev.simatime.com";
    };
  };
  # Serval is the production server for apps
  #
  Com.Simatime.Serval = buildOS {
    deps = { que-server = Run.Que.Server; };
    configuration = {
      imports = [
        ./Com/Simatime/packages.nix
        ./Com/Simatime/Serval/hardware.nix
        ./Com/Simatime/Serval/networking.nix
        ./Com/Simatime/Serval/configuration.nix
        ./Run/Que/service.nix
      ];
      networking.hostName = "serval";
      networking.domain = "serval.simatime.com";
      boot.enableContainers = true;
    };
  };
  # Haskell targets
  #
  Com.InfluencedByBooks.Server = buildGhc Com/InfluencedByBooks/Server.hs;
  Com.InfluencedByBooks.Client = buildGhcjs Com/InfluencedByBooks/Client.hs;
  Com.MusicMeetsComics.Server = buildGhc Com/MusicMeetsComics/Server.hs;
  Com.MusicMeetsComics.Client = buildGhcjs Com/MusicMeetsComics/Client.hs;
  Run.Que.Server = buildGhc ./Run/Que/Server.hs;
  Run.Que.Website = buildGhc ./Run/Que/Website.hs;
}