port to flakes

This commit is contained in:
Tim Schubert 2021-06-13 13:43:21 +02:00
parent deaa4fb75c
commit 2d9150098e
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
76 changed files with 721 additions and 315 deletions

View file

@ -0,0 +1,46 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.fileShare;
sharePath = "/mnt/storage/share";
ipv6 = "fd42:dead:beef::/48";
ipv4 = "192.168.42.0/24";
in
{
options.dadada.fileShare = {
enable = mkEnableOption "Enable file share server";
};
config = mkIf cfg.enable {
services.samba = {
enable = true;
securityType = "user";
extraConfig = ''
workgroup = WORKGROUP
server string = media
netbios name = media
security = user
guest account = nobody
map to guest = bad user
'';
shares = {
public = {
path = sharePath;
browseable = "yes";
"read only" = "yes";
"guest ok" = "yes";
"guest only" = "yes";
"create mask" = "0660";
"directory mask" = "2770";
"force user" = "nobody";
"force group" = "nobody";
};
};
};
services.nfs = {
server.enable = true;
server.exports = ''
${sharePath} ${ipv6}(rw,all_squash,insecure,subtree_check) ${ipv4}(rw,all_squash,insecure,subtree_check) # map to user/group - in this case nobody
'';
};
};
}