mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 14:45:27 +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:
commit
7c2d15627a
|
@ -18,13 +18,29 @@ let
|
||||||
maintainers = [ adisbladis ];
|
maintainers = [ adisbladis ];
|
||||||
};
|
};
|
||||||
|
|
||||||
machine = { pkgs, lib, ... }: {
|
machine = { pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
usersharePath = "/var/lib/samba/usershares";
|
||||||
|
in {
|
||||||
virtualisation.emptyDiskImages = [ 4096 ];
|
virtualisation.emptyDiskImages = [ 4096 ];
|
||||||
networking.hostId = "deadbeef";
|
networking.hostId = "deadbeef";
|
||||||
boot.kernelPackages = kernelPackage;
|
boot.kernelPackages = kernelPackage;
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
boot.zfs.enableUnstable = enableUnstable;
|
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 ];
|
environment.systemPackages = [ pkgs.parted ];
|
||||||
|
|
||||||
# Setup regular fileSystems machinery to ensure forceImportAll can be
|
# Setup regular fileSystems machinery to ensure forceImportAll can be
|
||||||
|
@ -58,8 +74,15 @@ let
|
||||||
"udevadm settle",
|
"udevadm settle",
|
||||||
"zpool create rpool /dev/vdb1",
|
"zpool create rpool /dev/vdb1",
|
||||||
"zfs create -o mountpoint=legacy rpool/root",
|
"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",
|
"mount -t zfs rpool/root /tmp/mnt",
|
||||||
"udevadm settle",
|
"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",
|
"umount /tmp/mnt",
|
||||||
"zpool destroy rpool",
|
"zpool destroy rpool",
|
||||||
"udevadm settle",
|
"udevadm settle",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# Userspace dependencies
|
# Userspace dependencies
|
||||||
, zlib, libuuid, python3, attr, openssl
|
, zlib, libuuid, python3, attr, openssl
|
||||||
, libtirpc
|
, libtirpc
|
||||||
, nfs-utils
|
, nfs-utils, samba
|
||||||
, gawk, gnugrep, gnused, systemd
|
, gawk, gnugrep, gnused, systemd
|
||||||
, smartmontools, enableMail ? false
|
, smartmontools, enableMail ? false
|
||||||
, sysstat, pkg-config
|
, 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
|
# 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; })
|
nfs-utils.override (old: { enablePython = old.enablePython or true && enablePython; })
|
||||||
}/bin/exportfs"
|
}/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/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" \
|
substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" \
|
||||||
--replace "/etc/default" "$out/etc/default"
|
--replace "/etc/default" "$out/etc/default"
|
||||||
|
|
Loading…
Reference in a new issue