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.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/machines/profpatsch/base-server.nix b/machines/profpatsch/base-server.nix
index 893df1ae..9d0a6819 100644
--- a/machines/profpatsch/base-server.nix
+++ b/machines/profpatsch/base-server.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
 let
-  sshPort = 6879;
+  cfg = config.vuizvui.user.profpatsch.server;
 
 in
 {
@@ -9,6 +9,13 @@ in
     ./base.nix
   ];
 
+  options.vuizvui.user.profpatsch.server.sshPort = 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 = {
 
     boot.cleanTmpDir = true;
@@ -17,13 +24,13 @@ in
 
     services.openssh = {
       enable = true;
-      listenAddresses = [ { addr = "0.0.0.0"; port = sshPort; } ];
+      listenAddresses = [ { addr = "0.0.0.0"; port = cfg.sshPort; } ];
     };
 
     networking.firewall = {
       enable = true;
       allowPing = true;
-      allowedTCPPorts = [ sshPort ];
+      allowedTCPPorts = [ cfg.sshPort ];
     };
 
   };