with apologies

OneDrive and NixOS

Richard Mortier · August 22, 2023 · #old #tech #linux #nixos

https://github.com/abraunegg/onedrive/blob/master/docs/SharePoint-Shared-Libraries.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://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNixOS%2Fnixpkgs%2Fblob%2Fmaster%2Fnixos%2Fmodules%2Fservices%2Fnetworking%2Fonedrive.nix&data=05%7C02%7Crmm1002%40universityofcambridgecloud.onmicrosoft.com%7C8792d760606b4a3e80d108dcbd47b53a%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638593362895323916%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=qPJyO0hTLRnrkbssZ0Y4cLfhaygDiEQtlQ0pwAjgMwM%3D&reserved=0.

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:

  1. Follow the instructions Robert pointed to sort out access to the various accounts, refresh tokens, and the like.

  2. 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.

  1. Edit the ~/.config/ACCOUNT/config files appropriately; the only changes I made were to

for my University account

sync_dir = “~/OneDrive/rmm1002@cam.ac.uk”

for my startup personal OneDrive

sync_dir = “~/OneDrive/mort@ikva.ai” sync_business_shared_folders = “true” 

for startup Sharepoint sites

sync_dir = “~/OneDrive/mort@ikva.ai-iKVA_Limited” drive_id = “…” # rune found per instructions Robert pointed to I think