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,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
cfg = config.programs.matrix-cyberia-pwa;
|
||||||
|
isChromium = cfg.package == pkgs.chromium;
|
||||||
|
isBrowserImpermanenceSupported = cfg.package == pkgs.chromium;
|
||||||
|
in {
|
||||||
options.programs.matrix-cyberia-pwa = {
|
options.programs.matrix-cyberia-pwa = {
|
||||||
enable = lib.mkEnableOption "enable 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 = {
|
xdg.desktopEntries.matrix-cyberia-pwa = {
|
||||||
name = "Matrix (Cyberia)";
|
name = "Matrix (Cyberia)";
|
||||||
type = "Application";
|
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";
|
icon = "matrix";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
categories = ["Network" "InstantMessaging"];
|
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}" = {
|
home.persistence."/persist${config.home.homeDirectory}" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/chromium"
|
"${config.xdg.configHome}/chromium"
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,43 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
cfg = config.programs.proton-calendar-pwa;
|
||||||
|
isChromium = cfg.package == pkgs.chromium;
|
||||||
|
isBrowserImpermanenceSupported = cfg.package == pkgs.chromium;
|
||||||
|
in {
|
||||||
options.programs.proton-calendar-pwa = {
|
options.programs.proton-calendar-pwa = {
|
||||||
enable = lib.mkEnableOption "enable 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 = {
|
xdg.desktopEntries.proton-calendar-pwa = {
|
||||||
name = "Proton Calendar";
|
name = "Proton Calendar";
|
||||||
type = "Application";
|
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";
|
icon = "chrome-ojibjkjikcpjonjjngfkegflhmffeemk-Default";
|
||||||
terminal = false;
|
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}" = {
|
home.persistence."/persist${config.home.homeDirectory}" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/chromium"
|
"${config.xdg.configHome}/chromium"
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,43 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
cfg = config.programs.proton-mail-pwa;
|
||||||
|
isChromium = cfg.package == pkgs.chromium;
|
||||||
|
isBrowserImpermanenceSupported = cfg.package == pkgs.chromium;
|
||||||
|
in {
|
||||||
options.programs.proton-mail-pwa = {
|
options.programs.proton-mail-pwa = {
|
||||||
enable = lib.mkEnableOption "enable 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 = {
|
xdg.desktopEntries.proton-mail-pwa = {
|
||||||
name = "Proton Mail";
|
name = "Proton Mail";
|
||||||
type = "Application";
|
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";
|
icon = "chrome-jnpecgipniidlgicjocehkhajgdnjekh-Default";
|
||||||
terminal = false;
|
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}" = {
|
home.persistence."/persist${config.home.homeDirectory}" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/chromium"
|
"${config.xdg.configHome}/chromium"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue