dotfiles/modules/common/repositories/notes.nix

37 lines
945 B
Nix
Raw Normal View History

2024-04-14 04:20:56 +00:00
{
config,
pkgs,
lib,
...
}:
{
2023-07-31 00:26:23 +00:00
# This is just a placeholder as I expect to interact with my notes in a
# certain location
home-manager.users.${config.user} = {
2022-05-02 03:39:50 +00:00
home.sessionVariables = {
2022-10-22 14:29:50 +00:00
NOTES_PATH = "${config.homePath}/dev/personal/notes/content";
2022-05-02 03:39:50 +00:00
};
2024-04-14 04:20:56 +00:00
# Sync notes for Nextcloud automatically
systemd.user.timers.refresh-notes = lib.mkIf config.services.nextcloud.enable {
Timer = {
OnCalendar = "*-*-* *:0/10:50"; # Every 10 minutes
Unit = "refresh-notes.service";
};
};
systemd.user.services.refresh-notes = {
Unit.Description = "Get latest notes.";
Service = {
Type = "oneshot";
ExecStartPre = "${pkgs.git}/bin/git -C /data/git/notes reset --hard master";
ExecStart = "${pkgs.git}/bin/git -C /data/git/notes pull";
WorkingDirectory = config.homePath;
Environment = "PATH=${pkgs.openssh}/bin";
};
};
2022-05-02 03:39:50 +00:00
};
}