diff --git a/modules/nixos/common/default.nix b/modules/nixos/common/default.nix index d8c1c8f..3101be2 100644 --- a/modules/nixos/common/default.nix +++ b/modules/nixos/common/default.nix @@ -3,6 +3,7 @@ imports = [ ./hardware ./core.nix + ./networking.nix ./user.nix ./ssh-server.nix ]; diff --git a/modules/nixos/common/networking.nix b/modules/nixos/common/networking.nix new file mode 100644 index 0000000..f3b928a --- /dev/null +++ b/modules/nixos/common/networking.nix @@ -0,0 +1,34 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.skyg.core; +in +{ + options = { + skyg.core = { + hostName = mkOption { + description = "Machine Hostname"; + type = types.str; + }; + }; + }; + config = { + # Define hostname. + networking.hostName = cfg.hostName; + + # Enable networking + networking.networkmanager.enable = true; + + # NFS Support + services.nfs.server.enable = true; + + # Tailscale + services.tailscale.enable = true; + services.tailscale.useRoutingFeatures = "client"; + + # Disable the flaky nm service + systemd.services.NetworkManager-wait-online.enable = false; + }; +} diff --git a/modules/nixos/common/ssh-server.nix b/modules/nixos/common/ssh-server.nix index aa321c3..e0bce1d 100644 --- a/modules/nixos/common/ssh-server.nix +++ b/modules/nixos/common/ssh-server.nix @@ -18,6 +18,7 @@ in config = mkIf cfg.enabled { services.openssh = { enable = true; + openFirewall = true; settings.PasswordAuthentication = false; settings.KbdInteractiveAuthentication = false; settings.PermitRootLogin = "yes"; diff --git a/modules/os/default.nix b/modules/os/default.nix index b9ac6a3..0c82e7a 100644 --- a/modules/os/default.nix +++ b/modules/os/default.nix @@ -15,15 +15,7 @@ user = user; } // containers)) ] - ++ (if enableNetworking then - [ - (import ./networking.nix { - hostName = hostName; - firewall = firewall; - }) - ] - else - [ ]) ++ (if enableSSH then + ++ (if enableSSH then [ (import ./ssh.nix { enableSSHServer = true; diff --git a/modules/os/networking.nix b/modules/os/networking.nix deleted file mode 100644 index 952a0e7..0000000 --- a/modules/os/networking.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ hostName, firewall }: -{ pkgs, ... }: -{ - # Define your hostname. - networking.hostName = hostName; - - # Enable networking - networking.networkmanager.enable = true; - networking.firewall = firewall; - - # NFS Support - services.nfs.server.enable = true; - - # Tailscale - services.tailscale.enable = true; - services.tailscale.useRoutingFeatures = "client"; - - # Disable the flaky nm service - systemd.services.NetworkManager-wait-online.enable = false; -} diff --git a/modules/skyg/core.nix b/modules/skyg/core.nix deleted file mode 100644 index 7b0e074..0000000 --- a/modules/skyg/core.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.skyg.core; -in -{ - options = { - skyg.core = { - hostName = mkOption { - description = "Machine Hostname"; - type = types.str; - }; - }; - }; - - config = { - networking.hostName = cfg.hostName; - }; -} diff --git a/modules/skyg/default.nix b/modules/skyg/default.nix index c2bb296..dfd4752 100644 --- a/modules/skyg/default.nix +++ b/modules/skyg/default.nix @@ -1,7 +1,6 @@ { ... }: { imports = [ - ./core.nix ./user.nix ./macos.nix ./fonts.nix