Intro

In my last tutorial, I demonstrated how to set up a barebones Nextcloud instance using Docker. The following guide assumes you have completed this step, and will focus on tying it all together into a seamless system.

Files

The most essential part of your workflow is going to be your file management. Figure out which devices you want to include in this system and install the appropriate Nextcloud client on all of them.

  • Contacts
  • Calendars
  • Location
  • Tasks
  • Photos
  • Texts
  • Notes

For my photos, I simply add the camera libraries I care about to the “Auto Upload” section in the Android Nextcloud client. These are auto-organized into folders by month, and put into a central “Photos” location on my server. Any screenshot, meme, or photo will be auto uploaded to the appropriate folder.

Contacts and calendars are all handled with DAVx⁵ android app. Link this with the Nextcloud client and choose which address books and calendars you want to synchronize with your server. These should show up in the native Contacts and Calendar apps.

Texts can be synchronized with the Nextcloud SMS app. This does have some limitations, as you cannot write/send SMS messages in the mobile or desktop app. It is useful for backing up and viewing conversations though.

Optionally, a location client like Traccar can be set up using a link from the Phonetrack app on Nextcloud. This is kind of like a personal “Find my iPhone”, with the added benefit of logging and backing up gpx files which can be analyzed for whatever data you please. There are numerous gpx editor apps on the store, but PhoneTrack has a great built in filtering system.

I use the OpenTasks appkhard to synchronize tasks from my Nextcloud server. The Tasks app on Nextcloud is my primary way of keeping track of assignments and todos, and having it on mobile is great. My only wish was to be able to see due dates for tasks in the calendar application.

Although I usually prefer neovim as my text editor of choice, I am currently trying the Carnet app (also available on Nextcloud store) because it has some nifty notetaking features that I have yet to replicate in neovim.

Finally, I like to have some extra security for my server. I downloaded and enabled the Two-factor authentication application, and linked it up with Google Authenticator to easily verify my 2FA logins. Most of the applications going forward will be using “App Passwords” that can be generated in the Security section of the Settings. This way you can let certain applications bypass 2FA.

Both my laptop and desktop are running Arch Linux, so the setup for both of them is essentially the same. Not only this, but the directory structure of each machine is essentially 1:1, so the experience is like browsing one large synchronized filesystem.

Like with the mobile client, set up the source -> destination connections for the desired folders on your machines. I recommend taking some time to think through a directory structure you will be happy with in the long term.

  • Files
  • Contacts
  • Calendars
  • Email

To manage Contacts and Calendars, I use a program called vdirsyncer to synchronize the necessary contact/calendar files with the server. The configuration for this tool is quite simple. I will post an example below.


[general]
status_path = "~/.config/vdirsyncer/status/"

[pair my_contacts]
a = "my_contacts_local"
b = "my_contacts_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"

[storage my_contacts_local]
type = "filesystem"
path = "~/Documents/Contacts/"
fileext = ".vcf"

[storage my_contacts_remote]
type = "carddav"

# We can simplify this URL here as well. In theory it shouldn't matter.
url = "URL_TO_NEXTCLOUD"
username = "USERNAME"
password = "GENERATED_APP_PASSWORD"

[pair my_calendar]
a = "my_calendar_local"
b = "my_calendar_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"

[storage my_calendar_local]
type = "filesystem"
path = "~/Documents/Calendar/"
fileext = ".ics"

[storage my_calendar_remote]
type = "caldav"

# We can simplify this URL here as well. In theory it shouldn't matter.
url = "URL_TO_NEXTCLOUD"
username = "USERNAME"
password = "GENERATED_APP_PASSWORD"

Run the commands vdirsyncer discover my_contacts and vdirsyncer discover my_calendar to populate the directories. If everything is set up correctly, vdirsyncer sync should synchronize any changes made to the local or remote versions of the files.

Conflict resolution for these files is dependant on the setting defined by conflict_resolution.

But how do we interact with these files?

Currently, I use the application khal. Run khal --config to go through the interactive prompt and point it at your calendar files. This will generate a configuration file .config/khal/config. To view and edit your calendar, you can use the built in commands or khal interactive for a more traditional TUI experience.

In each calendar folder, you can create a file called color, and fill it with a single color that you would like to highlight that calendar with. For example, one color file could have the line light cyan.

Much like the calendar, contacts are handled khard. run through the interactive configuration with khard --config.

Now I really don’t care about creating contacts on my desktop, because creating them with my phone works well and will propagate to all my devices. You certainly could create contacts with khard. As usual, run vdirsyncer sync to synchronize your files.

My favorite use for khard is to provide a contact database for my email client neomutt. The mail application in Nextcloud is pointed at my email server, so this should point there too (or whatever email server you are using). Configuring neomutt is kind of complex, and will be the topic of another tutorial.

However if you already have a working neomutt, you can add the line

set query_command = "khard email --parsable --search-in-source-files '%s'"

to your ~/.config/neomutt/settings file. This will make neomutt parse your contacts list when composing an email!

Other cool features

While these may not be absolutely essential, they really help bring Nextcloud to the next level; a life dashboard as opposed to simply a file sync service.

  • News: The Nextcloud news app and companion android app allow you to subscribe to a number of RSS/news feeds, viewing them all in one comfy application. Has some limitations, but works great for the most part.

  • Cookbook: The Cookbook app is one of my favorites, you can create your own recipes or import one from a website (assuming they are using a specific JSON format required by the app). I definitely killed a few hours by building up a hefty recipe bank. App is still in alpha, but suits my needs so far! I really want a treelike directory structure to sort recipes though.

  • Maps: I used a free API key for MapBox (configured in settings) and now I have a nifty map inside Nextcloud! It would be even more powerful with a dedicated routing server to provide Google Maps like directions. This map will display detected data found on the server, such as GPX tracks, photo location metadata, and contact addresses.

  • Keepweb: This application allows you to open and edit Keepass files on your server. Putting these files on your server can be a potential secrity risk, but there are plenty of encryption options to suit your needs. This synced kdbx file can be edited on the desktop (I prefer keepassxc), and viewed on the server if you need a password in a pinch.

  • Talk: Host a chatroom right out of your Nextcloud instance! I haven’t used this much, but in theory you can make voice and video calls, send text, and even polls and other chat features.

Conclusion

If you set it up right, Nextcloud can be far more versatile than a simple file synchronization service. Through Nextcloud, you can back up and manage contacts, calendars, emails, and much more. In combination with the ease of deployment docker provides, this setup is a formidable match for the out of the box services provided by larger companies. Let me know how you use Nextclud, I’m always on the lookout for great ways to integrate it into my workflow.