The current Nixpkgs fetchers use curl under the hood. Curl only supports SMB version 1. https://www.man7.org/linux/man-pages/man1/curl.1.html
A typical Windows server will be using SMB2 or SMB3. This fetcher should allow downloading resources from such Windows servers. It uses samba smbclient under the hood to behave like fetchurl.
One goal for this derivation is for it to be compatible with fetchzip. Please open an issue if you want support for other integrations.
let
pkgs = import <nixpkgs> {};
fetchsmb = import ./fetchsmb.nix {
inherit pkgs;
};
fetchzip = pkgs.fetchzip.override {
fetchurl = fetchsmb;
};
in
fetchzip {
# TODO: consider whether to support url's in this format:
# url = "//server-name/service-name/c/d/h.zip"
url = "//server-name/service-name";
directory = "c/d";
filename = "h.zip";
hash = pkgs.lib.fakeHash;
# url points to service-name instead of the file,
# so 'fetchzip' will always need the 'extension' field filled out.
extension = "zip";
}