about summary refs log tree commit diff
path: root/machines/profpatsch/base-server.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-07-08 14:41:57 +0200
committerProfpatsch <mail@profpatsch.de>2017-07-08 14:42:19 +0200
commita232772ebb63c27b530c9bac5fd53b3584dc7fc5 (patch)
tree64fcbbc19bd4983b5f22d96ad7b3d735ad65b8b4 /machines/profpatsch/base-server.nix
parent8380a6435e03d75e23840cc66d7b669df40dc7bf (diff)
machines/haku: refactor a bit to include into base server config
Until now, the config on the actual server was deviating because I changed it
locally.
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 ];
     };
 
   };