1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 05:00:16 +00:00

Merge pull request #92378 from jnetod/zfs-smb-share-fix

zfs: patch client path used in smb share
This commit is contained in:
Jörg Thalheim 2021-06-21 07:11:43 +02:00 committed by GitHub
commit 7c2d15627a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View file

@ -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",

View file

@ -6,7 +6,7 @@
# Userspace dependencies
, zlib, libuuid, python3, attr, openssl
, libtirpc
, nfs-utils
, nfs-utils, samba
, gawk, gnugrep, gnused, systemd
, smartmontools, enableMail ? false
, sysstat, pkg-config
@ -55,6 +55,7 @@ let
# And if it's enabled by default, only change that if we explicitly disable python to remove python from the closure
nfs-utils.override (old: { enablePython = old.enablePython or true && enablePython; })
}/bin/exportfs"
substituteInPlace ./lib/libshare/smb.h --replace "/usr/bin/net" "${samba}/bin/net"
substituteInPlace ./config/user-systemd.m4 --replace "/usr/lib/modules-load.d" "$out/etc/modules-load.d"
substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" \
--replace "/etc/default" "$out/etc/default"