fi33.buzz/blog/dufs.html
2025-01-28 19:09:19 +11:00

95 lines
No EOL
3.7 KiB
HTML

<!DOCTYPE html><html><head><title>quick and easy cloud storage with dufs and nixos</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="alternate" href="atom.xml" type="application/atom+xml" title="Atom feed"/><style>body{font-family:verdana;margin:40px auto;max-width:650px;line-height:1.6;font-size:18px;color:#d9d9d9;background-color:#000;padding:0 10px}html a{color:#00a2e7}html a:visited {color:#ca1a70}h1,h2,h3{line-height:1.2}</style></head><body><header><h1>will holdsworth's blog</h1><nav><a href="index.html">← all posts</a></nav></header><body><h2>quick and easy cloud storage with dufs and nixos</h2><p><i>posted: 2025/01/28 18:41<br>edited: 2025/01/28 19:06</i></p><p>
dufs[1] -- the distinctive file utility server -- is a decent cloud storage replacement for those looking to move away from third-party services like google drive or proton drive. it supports webdav and https file transfer protocols.
</p>
<p>
it's very easy to set up and get going in nixos using a docker container.
</p>
<h2> set up dufs </h2>
<p>
first, enable docker in your <code>configuration.nix</code>:
</p>
<pre><code>
virtualisation.docker.enable = true;
</code></pre>
<p>
then define a docker container, either in your <code>configuration.nix</code> or in a custom module:
</p>
<pre><code>
virtualisation.oci-containers = {
backend = "docker";
containers.dufs = {
# automatically restart server after reboot
autoStart = true;
image = "sigoden/dufs";
ports = [
"5000:5000"
];
# the files i want to serve are in /srv/dufs
volumes = [
"/srv/dufs:/data"
];
# tells dufs to serve the files in the docker volume /data
cmd = [
"-A"
"/data"
];
};
};
</code></pre>
<p>
rebuild your configuration using <code>nixos-rebuild switch</code> and head on over to <code>http://localhost:5000</code> to behold your lovely files.
</p>
<h2> set up tailscale</h2>
<p>
you can use tailscale[2] to access the files on other devices inside (and outside) of your home network. tailscale is like a crazy-fast vpn with a bunch of other comfort features like magic dns[3], keyless ssh[4] and easy https[5].
</p>
<p>
to enable it in nixos, add the following to your <code>configuration.nix</code>:
</p>
<pre><code>
services.tailscale.enable = true;
networking.firewall.trustedInterfaces = [ "tailscale0" ];
</code></pre>
<p>
once again, rebuild your configuration using <code>nixos-rebuild switch</code> and run <code>tailscale up</code> to start tailscale.
</p>
<p>
i recommend enabling magic dns in admin console &gt; dns &gt; magic dns, but if you prefer not to, your server's ip address will be visible by running <code>tailscale ip -4</code>.
</p>
<p>
head over to <code>http://&lt;hostname or ip&gt;:5000</code> on one of your other machines running tailscale to upload, download, and view your self-hosted files.
</p>
<h2> dufs clients</h2>
<p>
as for client recommendations, round sync[6] on android is quite good. it supports both webdav and https remotes, i chose to use webdav when connecting.
</p>
<p>
thanks for stopping by ^.^
</p>
<p>
[1] <a href="https://github.com/sigoden/dufs">dufs</a>
</p>
<p>
[2] <a href="https://tailscale.com/">tailscale</a>
</p>
<p>
[3] <a href="https://tailscale.com/kb/1081/magicdns">magic dns</a>
</p>
<p>
[4] <a href="https://tailscale.com/kb/1193/tailscale-ssh">tailscale ssh</a>
</p>
<p>
[5] <a href="https://tailscale.com/kb/1153/enabling-https">tailscale https</a>
</p>
<p>
[6] <a href="https://github.com/newhinton/Round-Sync">round sync</a>
</p>
<p><br></p></body><footer><hr>tags: self-hosting cloud-storage nixos tailscale</footer></body></html>