From 7d369ef34c1312172e3347a32684b9559abf859c Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Wed, 22 May 2024 17:52:06 +0300 Subject: [PATCH] modules/calendar: move khal to the calendar folder --- modules/home-manager/programs/calendar.nix | 35 ------------------- .../programs/calendar/default.nix | 6 ++++ .../home-manager/programs/calendar/khal.nix | 27 ++++++++++++++ modules/home-manager/programs/default.nix | 2 +- modules/nixos/configs/nix.nix | 3 -- 5 files changed, 34 insertions(+), 39 deletions(-) delete mode 100644 modules/home-manager/programs/calendar.nix create mode 100644 modules/home-manager/programs/calendar/default.nix create mode 100644 modules/home-manager/programs/calendar/khal.nix diff --git a/modules/home-manager/programs/calendar.nix b/modules/home-manager/programs/calendar.nix deleted file mode 100644 index e5c66d0..0000000 --- a/modules/home-manager/programs/calendar.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ config, lib, ... }: - -let - cfg = config.local.programs.calendar; - - mkCalOpts = name: { - enable = lib.mkEnableOption name; - - # Custom package doesn't work yet. - # See: https://github.com/nix-community/home-manager/pull/5428 - # package = lib.mkPackageOption pkgs name { }; - }; -in -{ - options.local.programs.calendar = { - khal = mkCalOpts "khal"; - }; - - config = { - accounts.calendar.basePath = "${config.xdg.dataHome}/calendars"; - - programs.khal = lib.mkIf cfg.khal.enable { - enable = true; - locale = rec { - timeformat = "%H:%M"; - dateformat = "%Y-%m-%d"; - longdateformat = dateformat; - datetimeformat = "${dateformat} ${timeformat}"; - longdatetimeformat = datetimeformat; - }; - # See: https://khal.readthedocs.io/en/latest/configure.html - settings = {}; - }; - }; -} diff --git a/modules/home-manager/programs/calendar/default.nix b/modules/home-manager/programs/calendar/default.nix new file mode 100644 index 0000000..fcb7354 --- /dev/null +++ b/modules/home-manager/programs/calendar/default.nix @@ -0,0 +1,6 @@ +{ config, ...}: +{ + imports = [./khal.nix]; + + config.accounts.calendar.basePath = "${config.xdg.dataHome}/calendars"; +} diff --git a/modules/home-manager/programs/calendar/khal.nix b/modules/home-manager/programs/calendar/khal.nix new file mode 100644 index 0000000..72d4dfa --- /dev/null +++ b/modules/home-manager/programs/calendar/khal.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: + +let cfg = config.local.programs.calendar; in +{ + options.local.programs.calendar.khal = { + enable = lib.mkEnableOption "khal"; + + # Custom package doesn't work yet. + # See: https://github.com/nix-community/home-manager/pull/5428 + # package = lib.mkPackageOption pkgs "khal" { }; + }; + + config = { + programs.khal = lib.mkIf cfg.khal.enable { + enable = true; + locale = rec { + timeformat = "%H:%M"; + dateformat = "%d.%m."; + longdateformat = "%d.%m.%Y"; + datetimeformat = "${dateformat} ${timeformat}"; + longdatetimeformat = "${longdateformat} ${timeformat}"; + }; + # See: https://khal.readthedocs.io/en/latest/configure.html + settings = { }; + }; + }; +} diff --git a/modules/home-manager/programs/default.nix b/modules/home-manager/programs/default.nix index fbc7456..7ce761c 100644 --- a/modules/home-manager/programs/default.nix +++ b/modules/home-manager/programs/default.nix @@ -3,12 +3,12 @@ { imports = [ ./aerc.nix - ./calendar.nix ./communication.nix ./dev-tools.nix ./flameshot.nix ./libreoffice.nix ./share-files.nix + ./calendar ./editors ./file-managers ./terminals diff --git a/modules/nixos/configs/nix.nix b/modules/nixos/configs/nix.nix index aa47876..e0bf4a7 100644 --- a/modules/nixos/configs/nix.nix +++ b/modules/nixos/configs/nix.nix @@ -42,9 +42,6 @@ in }; }; }) - (final: prev: { - khal = (import inputs.nixpkgs-unstable { inherit (config.nixpkgs) system; }).khal; - }) (final: prev: { unstable = import inputs.nixpkgs-unstable { inherit (config.nixpkgs) config overlays system;