about summary refs log tree commit diff
path: root/machines/profpatsch/base-server.nix
diff options
context:
space:
mode:
Diffstat (limited to 'machines/profpatsch/base-server.nix')
-rw-r--r--machines/profpatsch/base-server.nix60
1 files changed, 25 insertions, 35 deletions
diff --git a/machines/profpatsch/base-server.nix b/machines/profpatsch/base-server.nix
index 26b2f005..29b4709b 100644
--- a/machines/profpatsch/base-server.nix
+++ b/machines/profpatsch/base-server.nix
@@ -1,50 +1,40 @@
 { config, pkgs, lib, ... }:
 
 let
-  cfgImports = (import ../../pkgs/profpatsch/nixos-toml-modules.nix { inherit lib; }).readAnyToml ./base-server.toml
-    config;
+  cfg = config.vuizvui.user.profpatsch.server;
 
 in
 {
-  inherit (cfgImports) imports;
+  imports = [ ./base.nix ];
 
-  # 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
-    ;
+  options = {
+    vuizvui.user.profpatsch.server.sshPort = lib.mkOption {
+      description = "ssh port";
+      default = 7001;
+      type = lib.types.port;
+    };
+  };
 
-  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 ];
-      };
 
+  config = {
+    programs.mosh.enable = true;
 
-  # 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;
-  # });
+    services.openssh = {
+      enable = true;
+      listenAddresses = [{
+        addr = "0.0.0.0";
+        port = cfg.sshPort;
+      }];
+    };
 
-  # config = {
+    networking.enableIPv6 = false;
 
-  #   programs.mosh.enable = true;
+    networking.firewall = {
+      enable = true;
+      allowPing = true;
 
-  #   services.openssh = {
-  #     enable = true;
-  #     listenAddresses = [ { addr = "0.0.0.0"; port = cfg.sshPort; } ];
-  #   };
-
-  #   networking.firewall = {
-  #     enable = true;
-  #     allowPing = true;
-  #     allowedTCPPorts = [ cfg.sshPort ];
-  #   };
-
-  # };
+      allowedTCPPorts = [ cfg.sshPort ];
+    };
 
+  };
 }