about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2021-06-22 00:58:31 +0200
committerGitHub <noreply@github.com>2021-06-22 00:58:31 +0200
commiteef9694ebcb768345657b80e9d31bfc8e4be5190 (patch)
tree459d10fae562984e52085fd7ffbf5ec2f8322216 /nixos/tests
parent449df5db04c51df006dc0c7fd877f95e6dbf4b88 (diff)
parent9332bcad1813a87d7cd51e94dd9fd4a4aa11093c (diff)
downloadnixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.tar
nixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.tar.gz
nixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.tar.bz2
nixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.tar.lz
nixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.tar.xz
nixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.tar.zst
nixlib-eef9694ebcb768345657b80e9d31bfc8e4be5190.zip
Merge branch 'master' into staging-next
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/zfs.nix25
1 files changed, 24 insertions, 1 deletions
diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix
index ba5eb7cd528e..d25090403e5f 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
@@ -58,8 +74,15 @@ let
             "udevadm settle",
             "zpool create rpool /dev/vdb1",
             "zfs create -o mountpoint=legacy rpool/root",
+            # shared datasets cannot have legacy mountpoint
+            "zfs create rpool/shared_smb",
             "mount -t zfs rpool/root /tmp/mnt",
             "udevadm settle",
+            # wait for samba services
+            "systemctl is-system-running --wait",
+            "zfs set sharesmb=on rpool/shared_smb",
+            "zfs share rpool/shared_smb",
+            "smbclient -gNL localhost | grep rpool_shared_smb",
             "umount /tmp/mnt",
             "zpool destroy rpool",
             "udevadm settle",