Skip to content

feat: Documents Samba share + WebDAV at docs.zx.dev - #532

Merged
stackptr merged 10 commits into
mainfrom
glyph/samba-documents
Aug 25, 2026
Merged

stackptr merged 10 commits into
mainfrom
glyph/samba-documents

Conversation

@stackptr

Copy link
Copy Markdown
Owner

Summary

  • Adds a Documents Samba share on glyph (/mnt/documents, zdata/documents ZFS dataset) owned by a new partner system user — accessible over Tailscale via SMB
  • Adds a WebDAV endpoint (docs.zx.dev) proxied through spore with HTTPS + basic auth, so the share is accessible from Windows/macOS without any client software

Changes

  • hosts/glyph/default.nix — ZFS filesystem mount for zdata/documents, partner system user
  • hosts/glyph/services/samba.nixDocuments share with force user = partner, hourly chown
  • hosts/glyph/services/webdav.nix — nginx WebDAV server on port 8185 (Tailscale-only)
  • hosts/spore/services/web/default.nixdocs.zx.dev vhost proxying to glyph with basic auth
  • lib/secrets/spore.nix — registers docs-htpasswd.age for spore + Rhizome keys

Deploy steps

Prerequisites — run from Rhizome (or spore) before deploying:

  1. Create the ZFS dataset on glyph:

    ssh mu@glyph sudo zfs create zdata/documents
    
  2. Generate an htpasswd entry and encrypt it as an agenix secret:

    htpasswd -nB partner   # copy the output line
    direnv exec . agenix -e hosts/spore/secrets/docs-htpasswd.age
    # paste the htpasswd line, save
    git add hosts/spore/secrets/docs-htpasswd.age
    git commit --no-gpg-sign --amend --no-edit
    git push --force-with-lease
  3. Set the Samba password for the partner user on glyph (used for SMB access over Tailscale):

    ssh mu@glyph sudo smbpasswd -a partner
    

Deploy glyph:

nh os switch .#glyph

Deploy spore (after the htpasswd secret is committed):

nixos-rebuild switch --flake .#spore --target-host root@spore --build-host localhost

Connecting

WebDAV (no client required — remote or local):

  • macOS Finder: ⌘K → https://docs.zx.dev → username partner
  • Windows File Explorer: Map Network Drive → https://docs.zx.dev → username partner

SMB over Tailscale (if Tailscale is installed):

  • macOS: smb://glyph/Documents
  • Windows: \\glyph\Documents

🤖 Generated with Claude Code

@stackptr
stackptr force-pushed the glyph/samba-documents branch from e0be6c6 to b9af921 Compare August 25, 2026 19:00

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

stackptr and others added 4 commits August 25, 2026 14:40
Adds a `partner` system user, a ZFS filesystem at zdata/documents, and
a new Documents SMB share owned by that user. The hourly permissions
service is updated to keep the mount correctly owned.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: cfc8816bb650
Serves /mnt/documents over WebDAV via nginx on glyph (port 8185,
Tailscale-only), proxied through spore as docs.zx.dev with HTTPS and
basic auth. Both Windows and macOS can mount this natively without any
client software.

Note: hosts/spore/secrets/docs-htpasswd.age must be created with agenix
before deploying spore.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 1935831ebf09
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: fd38d04ac1a5
securityType is a NixOS option, not a smb.conf key. The correct
key inside settings.global is `security`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 8077d9a5bd73
@stackptr
stackptr force-pushed the glyph/samba-documents branch from 3ba0a01 to 247cadb Compare August 25, 2026 21:40
stackptr and others added 6 commits August 25, 2026 15:08
NixOS nginx service uses ProtectSystem=strict; /mnt/documents must be
explicitly listed in ReadWritePaths for MKCOL/PUT to succeed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 5559f87c0c42
Finder requires a successful LOCK before allowing write operations.
nginx does not implement LOCK/UNLOCK; return minimal valid responses
to unblock folder creation and file uploads from macOS clients.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 852033c3abec
macOS WebDAVFS checks for DAV: 1, 2 in OPTIONS responses before
enabling write operations in Finder. dav_ext_methods only sets DAV: 1;
add the level 2 advertisement to match our faked LOCK support.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 823a25ea90f9
nginx's dav module rejects MKCOL requests that carry a body, which
macOS WebDAVFS sends as extended MKCOL (RFC 5689). Apache mod_dav
handles extended MKCOL correctly and has full macOS compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 659245062958
{_} is a single named arg, not a wildcard; NixOS modules need {...}.
Use {lib, ...} to satisfy statix's empty_pattern check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: fb0c6aa19e44
Finder sends Destination: https://docs.zx.dev/... but Apache on glyph
sees itself as http://docs.zx.dev:8185, causing a 502 on MOVE. Rewrite
the Destination header to the internal URL before proxying.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 31842058822b
@stackptr
stackptr merged commit 3df02c0 into main Aug 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant