Skip to content

Commit

Permalink
feat(apps): make package installation optional (#389)
Browse files Browse the repository at this point in the history
Users should be able to configure a system-wide installation of
`{kate,ghostwriter,okular}` without needing to have a duplicate home
manager package. This behaviour was even documented in Kate's `package`
option, but did not work as the `nullable` tag wasn't set to true. This
commit corrects this behaviour.

Signed-off-by: Fernando Rodrigues <[email protected]>
  • Loading branch information
SigmaSquadron authored Oct 19, 2024
1 parent a895344 commit 154ec91
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions modules/apps/ghostwriter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,12 @@ in
"ghostwriter"
]
{
nullable = true;
example = "pkgs.kdePackages.ghostwriter";
extraDescription = ''
Use `pkgs.libsForQt5.ghostwriter` in Plasma5 and
`pkgs.kdePackages.ghostwriter` in Plasma6.
`pkgs.kdePackages.ghostwriter` in Plasma6. Use
`null` if home-manager should not install GhostWriter.
'';
};

Expand Down Expand Up @@ -601,7 +603,7 @@ in
}
];

home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];

programs.plasma.configFile = {
"kde.org/ghostwriter.conf" = (
Expand Down
1 change: 1 addition & 0 deletions modules/apps/kate/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ in
"kate"
]
{
nullable = true;
example = "pkgs.libsForQt5.kate";
extraDescription = ''
Which kate package to install. Use `pkgs.libsForQt5.kate` in Plasma5 and
Expand Down
5 changes: 3 additions & 2 deletions modules/apps/okular.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ with lib.types;
"okular"
]
{
nullable = true;
example = "pkgs.libsForQt5.okular";
extraDescription = ''
Which okular package to install. Use `pkgs.libsForQt5.okular` in Plasma5 and
`pkgs.kdePackages.okular` in Plasma6.
`pkgs.kdePackages.okular` in Plasma6. Use `null` if home-manager should not install Okular.
'';
};

Expand Down Expand Up @@ -193,7 +194,7 @@ with lib.types;
};

config = {
home.packages = lib.mkIf (cfg.enable) [ cfg.package ];
home.packages = lib.mkIf (cfg.enable && cfg.package != null) [ cfg.package ];
};

# ==================================
Expand Down

0 comments on commit 154ec91

Please sign in to comment.