From 78f9908a2673f1e400cbca2ae1c3c54231c74340 Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Sat, 13 Jul 2024 05:01:09 -0500 Subject: [PATCH] Add Samba Module. --- nixos/modules/nixos/system/default.nix | 1 + nixos/modules/nixos/system/samba/default.nix | 25 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 nixos/modules/nixos/system/samba/default.nix diff --git a/nixos/modules/nixos/system/default.nix b/nixos/modules/nixos/system/default.nix index 43478ea..cdbc6fa 100644 --- a/nixos/modules/nixos/system/default.nix +++ b/nixos/modules/nixos/system/default.nix @@ -8,6 +8,7 @@ ./pushover ./security.nix ./systempackages.nix + ./samba ./time.nix ./zfs.nix ]; diff --git a/nixos/modules/nixos/system/samba/default.nix b/nixos/modules/nixos/system/samba/default.nix new file mode 100644 index 0000000..3da8828 --- /dev/null +++ b/nixos/modules/nixos/system/samba/default.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: +let + cfg = config.mySystem.services.samba; +in +{ + options.mySystem.services.samba = { + enable = lib.mkEnableOption "samba"; + extraConfig = lib.mkOption { + type = lib.types.str; + default = ""; + }; + + shares = lib.mkOption { + type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); + default = ""; + }; + }; + + config = lib.mkIf cfg.enable { + services.samba.enable = true; + services.samba.extraConfig = cfg.extraConfig; + services.samba.shares = cfg.shares; + services.samba.openFirewall = true; + }; +}