OneDrive and NixOS
Richard Mortier · 2 min read · August 22, 2023 · #old #tech #linux #nixosStarting by reading instructions at:
- https://github.com/abraunegg/onedrive/blob/master/docs/sharepoint-libraries.md
- https://github.com/abraunegg/onedrive/blob/master/docs/business-shared-items.md
- https://github.com/NixOS/nixpkgs/pull/77734#issuecomment-575874225
FWIW I also use that package on a NixOS system (via a Nix package that can presumably be installed on other systems if you add nix as a package manager), https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/networking/onedrive.nix.
I have successfully used it with the University and my startup’s tenancies (both personal OneDrive and enterprise Sharepoint sites) simultaneously – this was fairly simple in the end but I recall it took a while to do the token dance to get the necessary tokens, and then to get all the runes right. In short it was something like:
Follow the instructions Robert pointed to sort out access to the various accounts, refresh tokens, and the like.
Create file
~/.config/onedrive-launcher
comprising each subdirectory of~/.config
that is a onedrive configuration directory corresponding to each account – I named these after the accounts in question so mine contained
onedrive-rmm1002@cam.ac.uk
onedrive-mort@ikva.ai
sharepoint-mort@ikva.ai-iKVALimited
(I now prefix the last two lines with #
to comment them out as I don’t need those synced any more.)
The systemd service onedrive-launcher.service
then uses the file to kick off a systemd onedrive@...
service for each entry.
- Edit the
~/.config/ACCOUNT/config
files appropriately; the only changes I made were to
"~/OneDrive/rmm1002@cam.ac.uk"
"~/OneDrive/mort@ikva.ai"
"true"
"~/OneDrive/mort@ikva.ai-iKVA_Limited"
"..."