aboutsummaryrefslogtreecommitdiffstats
path: root/modules/office/calcurse/default.nix
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-09-02 16:49:38 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-09-02 16:49:38 +0530
commitd5506ca50709f0b786d8ca8329f7cdbb7df9142e (patch)
treed2e351bcfe441443aa66bdf5d68f4d4df240705f /modules/office/calcurse/default.nix
parent2fdefe79b1ddc31241c22a7f88ae931ddc4180f3 (diff)
downloadhome-manager-config-d5506ca50709f0b786d8ca8329f7cdbb7df9142e.tar.gz
home-manager-config-d5506ca50709f0b786d8ca8329f7cdbb7df9142e.zip
feat(office/calcurse): calcurse-sync can now be setup in home-manager
Diffstat (limited to 'modules/office/calcurse/default.nix')
-rw-r--r--modules/office/calcurse/default.nix110
1 files changed, 65 insertions, 45 deletions
diff --git a/modules/office/calcurse/default.nix b/modules/office/calcurse/default.nix
index e8b38b6..c72896e 100644
--- a/modules/office/calcurse/default.nix
+++ b/modules/office/calcurse/default.nix
@@ -13,22 +13,27 @@ let
paths = [
pkgs.bash
pkgs.calcurse
- calcurseSync
]
- ++ lib.optionals config.development.nixvim.enable [ config.development.nixvim.package ];
+ ++ lib.optionals config.development.nixvim.enable [ config.development.nixvim.package ]
+ ++ lib.optionals config.office.calcurse.sync.enable [ calcurseSync ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
${lib.optionalString config.development.nixvim.enable ''
wrapProgram $out/bin/calcurse --set PAGER "nvim"
''}
- wrapProgram $out/bin/calcurse-sync \
- --prefix PATH : ${
- lib.makeBinPath [
- config.development.git.package
- pkgs.coreutils
- pkgs.gnused
- ]
- }
+ ${lib.optionalString config.office.calcurse.sync.enable ''
+ wrapProgram $out/bin/calcurse-sync \
+ --prefix PATH : ${
+ lib.makeBinPath [
+ config.development.git.package
+ pkgs.coreutils
+ pkgs.gnused
+ ]
+ } \
+ ${lib.optionalString (config.office.calcurse.sync.remote != null) ''
+ --set CALCURSE_SYNC_REMOTE ${lib.escapeShellArg config.office.calcurse.sync.remote}
+ ''}
+ ''}
'';
meta = {
mainProgram = "calcurse";
@@ -44,44 +49,59 @@ in
default = calcursePackage;
description = "The calcurse package to use.";
};
- };
- config = lib.mkIf config.office.calcurse.enable {
- home.packages = [ config.office.calcurse.package ];
- xdg.configFile."calcurse/conf" = {
- source = ./conf;
- force = true;
- };
- xdg.configFile."calcurse/keys" = {
- source = ./keys;
- force = true;
- };
- xdg.configFile."calcurse/hooks/pre-load" = {
- source = ./hooks/pre-load;
- executable = true;
- force = true;
- };
- xdg.configFile."calcurse/hooks/post-save" = {
- source = ./hooks/post-save;
- executable = true;
- force = true;
+ sync = {
+ enable = lib.mkEnableOption "Enables git-backed syncing of the calcurse data directory (builds calcurse-sync, installs the sync hooks, and runs an initial 'calcurse-sync init' on activation).";
+ remote = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ description = "Git remote URL for the calcurse data directory. When set, calcurse-sync uses it automatically on first init instead of prompting.";
+ };
};
+ };
- programs.git.includes = lib.mkIf config.development.git.enable [
+ config = lib.mkIf config.office.calcurse.enable (
+ lib.mkMerge [
{
- condition = "gitdir:${config.xdg.dataHome}/calcurse/";
- contents = {
- user = {
- name = "Calcurse of ${config.home.username}";
- email = "${config.home.username}@calcurse.localhost";
- };
- commit = {
- gpgSign = false;
- };
- tag = {
- gpgSign = false;
- };
+ home.packages = [ config.office.calcurse.package ];
+ xdg.configFile."calcurse/conf" = {
+ source = ./conf;
+ force = true;
+ };
+ xdg.configFile."calcurse/keys" = {
+ source = ./keys;
+ force = true;
};
}
- ];
- };
+ (lib.mkIf config.office.calcurse.sync.enable {
+ xdg.configFile."calcurse/hooks/pre-load" = {
+ source = ./hooks/pre-load;
+ executable = true;
+ force = true;
+ };
+ xdg.configFile."calcurse/hooks/post-save" = {
+ source = ./hooks/post-save;
+ executable = true;
+ force = true;
+ };
+
+ programs.git.includes = lib.mkIf config.development.git.enable [
+ {
+ condition = "gitdir:${config.xdg.dataHome}/calcurse/";
+ contents = {
+ user = {
+ name = "Calcurse of ${config.home.username}";
+ email = "${config.home.username}@calcurse.localhost";
+ };
+ commit.gpgSign = false;
+ tag.gpgSign = false;
+ };
+ }
+ ];
+
+ home.activation.calcurseSyncInit = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
+ run ${config.office.calcurse.package}/bin/calcurse-sync init || true
+ '';
+ })
+ ]
+ );
}