treewide: null package support (#6582)

Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
This commit is contained in:
Austin Horstman 2025-03-07 18:17:52 -06:00 committed by GitHub
parent 6c2b79403e
commit d2c014e1c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
83 changed files with 269 additions and 222 deletions

View file

@ -23,9 +23,6 @@ let
formatPair = key: value:
if isAttrs value then formatSet key value else formatLine key value;
homeConf = "${config.xdg.configHome}/task/home-manager-taskrc";
userConf = "${config.xdg.configHome}/task/taskrc";
in {
options = {
programs.taskwarrior = {
@ -85,13 +82,18 @@ in {
'';
};
package =
mkPackageOption pkgs "taskwarrior" { example = "pkgs.taskwarrior3"; };
package = mkPackageOption pkgs "taskwarrior" {
nullable = true;
example = "pkgs.taskwarrior3";
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
config = let
homeConf = "${config.xdg.configHome}/task/home-manager-taskrc";
userConf = "${config.xdg.configHome}/task/taskrc";
in mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${homeConf}".text = ''
data.location=${cfg.dataLocation}