feat: added more options to pwa packages
This commit is contained in:
parent
aab05a8135
commit
b75aaca605
3 changed files with 72 additions and 12 deletions
|
|
@ -3,24 +3,44 @@
|
|||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
cfg = config.programs.matrix-cyberia-pwa;
|
||||
isChromium = cfg.package == pkgs.chromium;
|
||||
isBrowserImpermanenceSupported = cfg.package == pkgs.chromium;
|
||||
in {
|
||||
options.programs.matrix-cyberia-pwa = {
|
||||
enable = lib.mkEnableOption "enable Matrix Cyberia PWA";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.chromium;
|
||||
description = "Browser package to use for the PWA";
|
||||
};
|
||||
impermanence = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = isBrowserImpermanenceSupported;
|
||||
description = "Enable impermanence configuration for the PWA. Only automatically enabled when using chromium.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.programs.matrix-cyberia-pwa.enable (lib.mkMerge [
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{
|
||||
xdg.desktopEntries.matrix-cyberia-pwa = {
|
||||
name = "Matrix (Cyberia)";
|
||||
type = "Application";
|
||||
exec = "${pkgs.chromium}/bin/chromium --app=https://chat.cyberia.club/";
|
||||
exec = "${cfg.package}/bin/${cfg.package.pname} --app=https://chat.cyberia.club/";
|
||||
icon = "matrix";
|
||||
terminal = false;
|
||||
categories = ["Network" "InstantMessaging"];
|
||||
};
|
||||
|
||||
warnings =
|
||||
lib.optional (config.impermanence.enable && !isBrowserImpermanenceSupported)
|
||||
"matrix-cyberia-pwa: Using unsupported package with impermanence enabled. You will need to manually configure impermanence for ${cfg.package.pname}. Supported package(s) ${pkgs.chromium.pname}";
|
||||
}
|
||||
(
|
||||
lib.mkIf config.impermanence.enable {
|
||||
lib.mkIf (config.impermanence.enable && cfg.impermanence.enable && isChromium) {
|
||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
||||
directories = [
|
||||
"${config.xdg.configHome}/chromium"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue