feat: added more options to pwa packages

This commit is contained in:
Leyla Becker 2025-12-21 01:42:59 -06:00
parent aab05a8135
commit b75aaca605
3 changed files with 72 additions and 12 deletions

View file

@ -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"

View file

@ -3,23 +3,43 @@
pkgs,
config,
...
}: {
}: let
cfg = config.programs.proton-calendar-pwa;
isChromium = cfg.package == pkgs.chromium;
isBrowserImpermanenceSupported = cfg.package == pkgs.chromium;
in {
options.programs.proton-calendar-pwa = {
enable = lib.mkEnableOption "enable Proton Calendar 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.proton-calendar-pwa.enable (lib.mkMerge [
config = lib.mkIf cfg.enable (lib.mkMerge [
{
xdg.desktopEntries.proton-calendar-pwa = {
name = "Proton Calendar";
type = "Application";
exec = "${pkgs.chromium}/bin/chromium --app=https://calendar.proton.me";
exec = "${cfg.package}/bin/${cfg.package.pname} --app=https://calendar.proton.me";
icon = "chrome-ojibjkjikcpjonjjngfkegflhmffeemk-Default";
terminal = false;
};
warnings =
lib.optional (config.impermanence.enable && !isBrowserImpermanenceSupported)
"proton-calendar-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"

View file

@ -3,23 +3,43 @@
pkgs,
config,
...
}: {
}: let
cfg = config.programs.proton-mail-pwa;
isChromium = cfg.package == pkgs.chromium;
isBrowserImpermanenceSupported = cfg.package == pkgs.chromium;
in {
options.programs.proton-mail-pwa = {
enable = lib.mkEnableOption "enable Proton Mail 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.proton-mail-pwa.enable (lib.mkMerge [
config = lib.mkIf cfg.enable (lib.mkMerge [
{
xdg.desktopEntries.proton-mail-pwa = {
name = "Proton Mail";
type = "Application";
exec = "${pkgs.chromium}/bin/chromium --app=https://mail.proton.me";
exec = "${cfg.package}/bin/${cfg.package.pname} --app=https://mail.proton.me";
icon = "chrome-jnpecgipniidlgicjocehkhajgdnjekh-Default";
terminal = false;
};
warnings =
lib.optional (config.impermanence.enable && !isBrowserImpermanenceSupported)
"proton-mail-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"