Skip to content

Commit

Permalink
feat(samba): share samba directory to all users
Browse files Browse the repository at this point in the history
Every users who are in samba group, they can access to samba share
directory
  • Loading branch information
Wittano committed Jan 24, 2025
1 parent dc840b9 commit 6d3eefb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions hosts/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ mkMerge [
work = {
isNormalUser = true;
uid = mkDefault 1002;
extraGroups = [ "wheel" ];
shell = pkgs.fish;
};
};
Expand Down
15 changes: 15 additions & 0 deletions nixos/hardware/samba.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ with lib;
with lib.my;
let
cfg = config.hardware.samba;

sambaGroupName = "samba";
in
{

Expand All @@ -19,18 +21,31 @@ in
];
};

users = {
users = {
wittano.extraGroups = [ sambaGroupName ];
wito.extraGroups = [ sambaGroupName ];
work.extraGroups = [ sambaGroupName ];
};
groups.samba.gid = 988;
};

fileSystems."/mnt/samba" = {
device = "//192.168.1.5/samba/wittano";
fsType = "cifs";
options = [
"credentials=${config.age.secrets.samba.path}"
"uid=${builtins.toString config.users.users.wittano.uid}"
"gid=${sambaGroupName}"
"x-systemd.automount"
"noauto"
"x-systemd.idle-timeout=60"
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
"user"
"file_mode=0774"
"dir_mode=0774"
"rw"
"users"
];
};
Expand Down

0 comments on commit 6d3eefb

Please sign in to comment.