network: extract nixos module

This commit is contained in:
Zynh Ludwig 2024-10-06 07:08:00 -07:00
parent 7c8baf7f32
commit c8fdfc2f3a
3 changed files with 24 additions and 12 deletions

View file

@ -63,18 +63,6 @@
# Enable trash:/// support # Enable trash:/// support
services.gvfs.enable = true; services.gvfs.enable = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.openFirewall = true;
services.avahi.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?

View file

@ -13,6 +13,7 @@ in
snowhawk.i18n.enable = lib.mkDefault true; snowhawk.i18n.enable = lib.mkDefault true;
snowhawk.audio.enable = lib.mkDefault true; snowhawk.audio.enable = lib.mkDefault true;
snowhawk.env.enable = lib.mkDefault true; snowhawk.env.enable = lib.mkDefault true;
snowhawk.network.enable = lib.mkDefault true;
snowhawk.sops.enable = lib.mkDefault true; snowhawk.sops.enable = lib.mkDefault true;
snowhawk.power-button.enable = lib.mkDefault true; snowhawk.power-button.enable = lib.mkDefault true;
} }

23
modules/network.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, lib, ... }:
let
cfg = config.snowhawk.network;
in
{
options.snowhawk.network = {
enable = lib.mkEnableOption "network nixos module";
};
config = lib.mkIf cfg.enable {
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.openFirewall = true;
services.avahi.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
};
}