Skip to content

Commit

Permalink
feat(nixos): add declarative calendar synchronisation
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenhoenle committed Jul 14, 2024
1 parent 2fe61cd commit 3389cf8
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ sudo fprintd-enroll ruben
sudo fprintd-verify ruben
```

## Calendar sync

```bash
# initial discover (after initial config apply or calendar config change)
vdirsyncer discover calendar_nextcloud

# sync the calendars
vdirsyncer sync

# view calendar
khal
```

## agenix

[agenix](https://github.com/ryantm/agenix) is a tool for encrypted secrets in your NixOS config.
Expand Down
39 changes: 39 additions & 0 deletions home/calendar.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ pkgs, osConfig, ... }:
{
programs.vdirsyncer.enable = true;
services.vdirsyncer.enable = true;
programs.khal.enable = true;

accounts.calendar = {
basePath = "/home/ruben/.calendars";

accounts = {
nextcloud = {
khal = {
enable = true;
color = "light green";
type = "discover";
};

local = {
type = "filesystem";
fileExt = ".ics";
};

remote = {
type = "caldav";
url = "https://cloud.hoenle.xyz/remote.php/dav";
userName = "ruben";
passwordCommand = [ "${pkgs.coreutils}/bin/cat" osConfig.age.secrets.nextcloudCalendarToken.path ];
};

vdirsyncer = {
enable = true;
metadata = [ "color" ];
collections = [ "persnlich" ];
conflictResolution = "remote wins";
};
};
};
};
}
2 changes: 2 additions & 0 deletions home/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
./sway/default.nix
./neovim/neovim.nix

./calendar.nix

./default-applications.nix
];

Expand Down
3 changes: 3 additions & 0 deletions home/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
wgu = "systemctl start wg-quick-wg0";
wgd = "systemctl stop wg-quick-wg0";
wgs = "systemctl status wg-quick-wg0";

# calendar
kal = "khal interactive";
};
enableCompletion = true;

Expand Down
5 changes: 5 additions & 0 deletions modules/secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@
owner = "ruben";
group = "users";
};
age.secrets.nextcloudCalendarToken = {
file = ../secrets/nextcloud-calendar-token.age;
owner = "ruben";
group = "users";
};
}
5 changes: 5 additions & 0 deletions secrets/nextcloud-calendar-token.age
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
age-encryption.org/v1
-> ssh-ed25519 Zy726Q bIX7CQQLDgJfXadjRBeAVLUgNql7wutBLISV32EeuiI
gkVAMceNIy+v8VDc8A87O+l/QcXNgM8SZQkWuzIBgA8
--- y7i2M4x/FGuHhlEhFY2ooCq1p5LOLdzeg9+5Z/Q6cvU
��8uO���y঵Ρ��J�w������9����*4޼��s��ď���5[cf�a�q
1 change: 1 addition & 0 deletions secrets/secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ in
"backblaze-b2-restic-s3-secrets.age".publicKeys = [ deathstar millenium-falcon ];
"wireguard-private-key.age".publicKeys = [ millenium-falcon ];
"wireguard-preshared-key.age".publicKeys = [ millenium-falcon ];
"nextcloud-calendar-token.age".publicKeys = [ millenium-falcon ];
}

0 comments on commit 3389cf8

Please sign in to comment.