2024-09-19 14:19:46 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "samba";
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
meta.maintainers = [ lib.maintainers.anthonyroussel ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nodes = {
|
|
|
|
client =
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
virtualisation.fileSystems = {
|
|
|
|
"/public" = {
|
|
|
|
fsType = "cifs";
|
|
|
|
device = "//server/public";
|
|
|
|
options = [ "guest" ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-09-19 14:19:46 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
server =
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
services.samba = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
settings = {
|
|
|
|
"public" = {
|
|
|
|
"path" = "/public";
|
2020-04-24 23:36:52 +00:00
|
|
|
"read only" = true;
|
2024-09-19 14:19:46 +00:00
|
|
|
"browseable" = "yes";
|
2020-04-24 23:36:52 +00:00
|
|
|
"guest ok" = "yes";
|
2024-09-19 14:19:46 +00:00
|
|
|
"comment" = "Public samba share.";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-09-19 14:19:46 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-09-19 14:19:46 +00:00
|
|
|
};
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
testScript = ''
|
|
|
|
server.start()
|
|
|
|
server.wait_for_unit("samba.target")
|
|
|
|
server.succeed("mkdir -p /public; echo bar > /public/foo")
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
client.start()
|
|
|
|
client.wait_for_unit("remote-fs.target")
|
|
|
|
client.succeed("[[ $(cat /public/foo) = bar ]]")
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|