1import ./make-test.nix ({ pkgs, ... }:
2
3{
4 name = "samba";
5
6 meta.maintainers = [ pkgs.lib.maintainers.eelco ];
7
8 nodes =
9 { client =
10 { pkgs, ... }:
11 { fileSystems = pkgs.lib.mkVMOverride
12 { "/public" = {
13 fsType = "cifs";
14 device = "//server/public";
15 options = [ "guest" ];
16 };
17 };
18 };
19
20 server =
21 { ... }:
22 { services.samba.enable = true;
23 services.samba.shares.public =
24 { path = "/public";
25 "read only" = true;
26 browseable = "yes";
27 "guest ok" = "yes";
28 comment = "Public samba share.";
29 };
30 networking.firewall.allowedTCPPorts = [ 139 445 ];
31 networking.firewall.allowedUDPPorts = [ 137 138 ];
32 };
33 };
34
35 # client# [ 4.542997] mount[777]: sh: systemd-ask-password: command not found
36
37 testScript =
38 ''
39 $server->start;
40 $server->waitForUnit("samba.target");
41 $server->succeed("mkdir -p /public; echo bar > /public/foo");
42
43 $client->start;
44 $client->waitForUnit("remote-fs.target");
45 $client->succeed("[[ \$(cat /public/foo) = bar ]]");
46 '';
47})