summaryrefslogtreecommitdiff
path: root/default.nix
blob: 55835007966798a3dc50850f717f25c4c127cfdb (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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;
  buildHaskellApp = import ./Com/Simatime/buildHaskellApp.nix nixpkgs;
  nixos-mailserver = builtins.fetchTarball {
    url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz";
    sha256 = "03d49v8qnid9g9rha0wg2z6vic06mhp0b049s3whccn1axvs2zzx";
  };
in {
  Com.Simatime = buildOS {
    enableVpn = true;
    ipAddress = "159.89.128.69";
    vpnRsaPrivateKeyFile = "/etc/tinc/rsa_key.priv";
    vpnEd25519PrivateKeyFile = "/etc/tinc/ed25519_key.priv";
    configuration = {
      imports = [
        ./Com/Simatime/hardware.nix
        ./Com/Simatime/networking.nix
        ./Com/Simatime/packages.nix
        ./Com/Simatime/git.nix
        ./Com/Simatime/mail.nix
        ./Com/Simatime/web.nix
        ./Com/Simatime/znc.nix
        nixos-mailserver
      ];
      programs.mosh = {
        enable = true;
        withUtempter = true;
      };
    };
  } // {
    dev = buildOS {
      enableVpn = true;
      ipAddress = "69.181.254.154";
      vpnConnectTo = "com.simatime";
      vpnRsaPrivateKeyFile = "/etc/tinc/rsa_key.priv";
      vpnEd25519PrivateKeyFile = "/etc/tinc/ed25519_key.priv";
      configuration = {
        imports = [
          ./Com/Simatime/packages.nix
          ./Com/Simatime/dev/hardware.nix
          ./Com/Simatime/dev/configuration.nix
        ];
      };
    };
    Serval = buildOS {
      configuration = {
        imports = [
          ./Com/Simatime/packages.nix
          ./Com/RunServal/hardware.nix
          ./Com/RunServal/networking.nix
        ];
        networking.hostName = "serval.simatime.com";
        boot.enableContainers = true;
      };
    };
  };
  Com.InfluencedByBooks = buildOS {
    configuration = {
      imports = [
        ./Com/InfluencedByBooks/service.nix
        ./Com/Simatime/packages.nix
      ];
      nixpkgs.config.allowUnfree = true;
      boot.isContainer = true;
      networking.useDHCP = false;
    };
  } // (buildHaskellApp {
    name = "Com.InfluencedByBooks";
    nick = "ibb";
    deps = {
      both = [
        "clay"
        "miso"
        "protolude"
        "servant"
        "text"
      ];
      apex = [
        "MonadRandom"
        "acid-state"
        "blaze-html"
        "blaze-markup"
        "bytestring"
        "ixset"
        "random"
        "safecopy"
        "scotty"
        "servant-server"
        "text"
      ];
      aero = [
        "aeson"
        "containers"
        "ghcjs-base"
      ];
    };
  });
}