From 86b1feefbdd51d57b5ca5be0050d992126dee411 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Fri, 11 Jun 2021 08:24:56 +0200 Subject: nixos/zfs: add tests for samba --- nixos/tests/zfs.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'nixos') diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix index ba5eb7cd528e..5a6138c68d47 100644 --- a/nixos/tests/zfs.nix +++ b/nixos/tests/zfs.nix @@ -18,13 +18,29 @@ let maintainers = [ adisbladis ]; }; - machine = { pkgs, lib, ... }: { + machine = { pkgs, lib, ... }: + let + usersharePath = "/var/lib/samba/usershares"; + in { virtualisation.emptyDiskImages = [ 4096 ]; networking.hostId = "deadbeef"; boot.kernelPackages = kernelPackage; boot.supportedFilesystems = [ "zfs" ]; boot.zfs.enableUnstable = enableUnstable; + services.samba = { + enable = true; + extraConfig = '' + registry shares = yes + usershare path = ${usersharePath} + usershare allow guests = yes + usershare max shares = 100 + usershare owner only = no + ''; + }; + systemd.services.samba-smbd.serviceConfig.ExecStartPre = + "${pkgs.coreutils}/bin/mkdir -m +t -p ${usersharePath}"; + environment.systemPackages = [ pkgs.parted ]; # Setup regular fileSystems machinery to ensure forceImportAll can be @@ -60,6 +76,8 @@ let "zfs create -o mountpoint=legacy rpool/root", "mount -t zfs rpool/root /tmp/mnt", "udevadm settle", + "zfs set sharesmb=on rpool/root", + "smbclient -NL localhost", "umount /tmp/mnt", "zpool destroy rpool", "udevadm settle", -- cgit 1.4.1