about summary refs log tree commit diff
path: root/machines/profpatsch/base-server.nix
blob: 26b2f0058dbcf986c30daacc22288a34844ab213 (plain) (blame)
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
{ config, pkgs, lib, ... }:

let
  cfgImports = (import ../../pkgs/profpatsch/nixos-toml-modules.nix { inherit lib; }).readAnyToml ./base-server.toml
    config;

in
{
  inherit (cfgImports) imports;

  # TODO: cannot read options from pkgs because it would lead to an infinite recursion
  # in the module system, since the pkgs passed into this module already requires all options.
  options = ((import ../../pkgs/profpatsch/nixos-toml-modules.nix { inherit lib; }).readAnyToml ./base-server-options.toml).options
    ;

  config =
    cfgImports.config
    # TODO: how to handle a reference to pkgs?
    // {
      # This can’t be in base.nix, because the workstations
      # have gitFull which leads to env collisions.
      environment.systemPackages = [ pkgs.git ];
      };


  # options.vuizvui.user.profpatsch.server.sshPort = lib.traceValSeqN 3 (lib.mkOption {
  #   description = "ssh port";
  #   # TODO: replace with types.intBetween https://github.com/NixOS/nixpkgs/pull/27239
  #   type = with lib.types; addCheck int (x: x >= 0 && x <= 65535);
  #   default = 6879;
  # });

  # config = {

  #   programs.mosh.enable = true;

  #   services.openssh = {
  #     enable = true;
  #     listenAddresses = [ { addr = "0.0.0.0"; port = cfg.sshPort; } ];
  #   };

  #   networking.firewall = {
  #     enable = true;
  #     allowPing = true;
  #     allowedTCPPorts = [ cfg.sshPort ];
  #   };

  # };

}