1{ lib, ... }:
2{
3 name = "samba";
4
5 meta.maintainers = [ lib.maintainers.anthonyroussel ];
6
7 nodes = {
8 client =
9 { ... }:
10 {
11 virtualisation.fileSystems = {
12 "/public" = {
13 fsType = "cifs";
14 device = "//server/public";
15 options = [ "guest" ];
16 };
17 };
18 };
19
20 server =
21 { ... }:
22 {
23 services.samba = {
24 enable = true;
25 openFirewall = true;
26 settings = {
27 "public" = {
28 "path" = "/public";
29 "read only" = true;
30 "browseable" = "yes";
31 "guest ok" = "yes";
32 "comment" = "Public samba share.";
33 };
34 };
35 };
36 };
37 };
38
39 testScript = ''
40 server.start()
41 server.wait_for_unit("samba.target")
42 server.succeed("mkdir -p /public; echo bar > /public/foo")
43
44 client.start()
45 client.wait_for_unit("remote-fs.target")
46 client.succeed("[[ $(cat /public/foo) = bar ]]")
47 '';
48}