diff --git a/hosts/backwards/configuration.nix b/hosts/backwards/configuration.nix index 44d36f1..51e11e0 100644 --- a/hosts/backwards/configuration.nix +++ b/hosts/backwards/configuration.nix @@ -78,8 +78,6 @@ pkgs.vim ]; - services.openssh.enable = true; - config-manager = { flakePath = "/home/alex/config"; }; diff --git a/hosts/backwards/modules/default.nix b/hosts/backwards/modules/default.nix index c3a3753..56689cc 100644 --- a/hosts/backwards/modules/default.nix +++ b/hosts/backwards/modules/default.nix @@ -7,6 +7,8 @@ in imports = lib.mapAttrsToList toModulePath (filterDirs (builtins.readDir ./.)); config = { - mod = {}; + mod = { + ssh.enable = true; + }; }; } diff --git a/hosts/backwards/modules/ssh/default.nix b/hosts/backwards/modules/ssh/default.nix new file mode 100644 index 0000000..075e675 --- /dev/null +++ b/hosts/backwards/modules/ssh/default.nix @@ -0,0 +1,32 @@ +{ lib, config, ... }: +let + enabled = config.mod.ssh.enable; +in +{ + options = { + mod.ssh = { + enable = lib.mkEnableOption "enable ssh module"; + }; + }; + + config = lib.mkIf enabled { + home-manager.users.alex = { + programs.ssh = { + enable = true; + }; + }; + + services = { + openssh = { + enable = true; + ports = [ 1122 ]; + }; + }; + + networking = { + firewall = { + allowedTCPPorts = [ 1122 ]; + }; + }; + }; +}