nixos/samba: ensure global section is always first

The order of the [global] section matters as settings
defined there are only applied to shares that are defines
after it.
This commit is contained in:
Pascal Bach
2024-09-12 21:08:24 +02:00
parent fab6b97bb4
commit e7bcab801c
@@ -6,7 +6,11 @@ let
cfg = config.services.samba;
settingsFormat = pkgs.formats.ini { };
configFile = settingsFormat.generate "smb.conf" cfg.settings;
# Ensure the global section is always first
globalConfigFile = settingsFormat.generate "smb-global.conf" { global = cfg.settings.global; };
sharesConfigFile = settingsFormat.generate "smb-shares.conf" (lib.removeAttrs cfg.settings [ "global" ]);
configFile = pkgs.concatText "smb.conf" [ globalConfigFile sharesConfigFile ];
in