summary refs log tree commit diff
path: root/nixos/tests/zfs.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2021-06-11 08:24:56 +0200
committerJörg Thalheim <joerg@thalheim.io>2021-06-11 08:24:56 +0200
commit86b1feefbdd51d57b5ca5be0050d992126dee411 (patch)
tree62f00497d6a04fdd34075ed0e1bffe15a792a875 /nixos/tests/zfs.nix
parente16e51702b9df803d172e7bdb4cbb4976778eee2 (diff)
downloadnixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.tar
nixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.tar.gz
nixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.tar.bz2
nixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.tar.lz
nixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.tar.xz
nixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.tar.zst
nixpkgs-86b1feefbdd51d57b5ca5be0050d992126dee411.zip
nixos/zfs: add tests for samba
Diffstat (limited to 'nixos/tests/zfs.nix')
-rw-r--r--nixos/tests/zfs.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix
index ba5eb7cd528..5a6138c68d4 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",