Don't start protonmail-bridge with plasma, setup systemd service

Move protonmail-bridge-setup and davmail-setup to respective email
definition files, rather than desktop settings

Update mimeapps with extra definitions from Plasma settings

Update README to rename protonmail-setup-bridge ->
protonmail-bridge-setup
This commit is contained in:
Evie Litherland-Smith 2024-06-18 09:31:38 +01:00
parent 942d13eb8e
commit eef58aa427
6 changed files with 49 additions and 91 deletions

View file

@ -30,7 +30,7 @@ To set up without cloning the repository, run:
* Email setup * Email setup
** Proton ** Proton
*** Bridge *** Bridge
Run src_bash{protonmail-setup-bridge} to automate this process. Run src_bash{protonmail-bridge-setup} to automate this process.
Run bridge in CLI mode to login, wait for initial sync and get app password Run bridge in CLI mode to login, wait for initial sync and get app password
#+begin_src bash #+begin_src bash

View file

@ -2,19 +2,7 @@
config, config,
pkgs, pkgs,
... ...
}: let }: {
protonmail-setup-bridge = with pkgs; (writeShellScriptBin "protonmail-setup-bridge" ''
pkill -9 -f protonmail-bridge
${protonmail-bridge}/bin/protonmail-bridge -c
swaymsg exec "${protonmail-bridge}/bin/protonmail-bridge -n"
'');
davmail-setup = with pkgs; (writeShellScriptBin "davmail-setup" ''
systemctl --user restart davmail # Ensure config file is present
systemctl --user stop davmail
${davmail}/bin/davmail -n ~/.davmail.properties
systemctl --user restart davmail
'');
in {
imports = [ imports = [
./plasma6/default.nix ./plasma6/default.nix
./alacritty/default.nix ./alacritty/default.nix
@ -23,60 +11,23 @@ in {
libreoffice-fresh libreoffice-fresh
inkscape inkscape
webcord webcord
protonmail-setup-bridge
davmail-setup
]; ];
services.syncthing.enable = true; services.syncthing.enable = true;
programs.mpv.enable = true; programs.mpv.enable = true;
# gtk = {
# enable = true;
# iconTheme = {
# package = pkgs.papirus-icon-theme.override {color = "violet";};
# name =
# if config.scheme.variant == "light"
# then "Papirus-Light"
# else "Papirus-Dark";
# };
# cursorTheme = {
# package = pkgs.volantes-cursors;
# name =
# if config.scheme.variant == "light"
# then "volantes_cursors"
# else "volantes_light_cursors";
# size = 32;
# };
# theme = {
# package = pkgs.gnome.gnome-themes-extra;
# name =
# if config.scheme.variant == "light"
# then "Adwaita"
# else "Adwaita-dark";
# };
# };
# qt = {
# enable = true;
# style = {
# package = pkgs.adwaita-qt;
# name =
# if config.scheme.variant == "light"
# then "adwaita"
# else "adwaita-dark";
# };
# };
xdg = { xdg = {
# mime.enable = true; mime.enable = true;
# mimeApps = let mimeApps = let
# defaultApplications = import ./mimeapps.nix; defaultApplications = import ./mimeapps.nix;
# in { in {
# enable = true; enable = true;
# inherit defaultApplications; inherit defaultApplications;
# associations = { associations = {
# added = defaultApplications; added = defaultApplications;
# removed = { removed = {
# "x-scheme-handler/zoomus" = config.xdg.mimeApps.defaultApplications."x-scheme-handler/http"; "x-scheme-handler/zoomus" = config.xdg.mimeApps.defaultApplications."x-scheme-handler/http";
# }; };
# }; };
# }; };
userDirs = { userDirs = {
enable = true; enable = true;
createDirectories = true; createDirectories = true;
@ -85,24 +36,4 @@ in {
}; };
}; };
}; };
# xresources.properties = with config.scheme.withHashtag; {
# "*background" = base00;
# "*foreground" = base05;
# "*color0" = base00;
# "*color1" = red;
# "*color2" = green;
# "*color3" = yellow;
# "*color4" = blue;
# "*color5" = magenta;
# "*color6" = cyan;
# "*color7" = base04;
# "*color8" = base01;
# "*color9" = red;
# "*color10" = green;
# "*color11" = yellow;
# "*color12" = blue;
# "*color13" = magenta;
# "*color14" = cyan;
# "*color15" = base05;
# };
} }

View file

@ -25,6 +25,7 @@ in {
"text/x-log" = emacs; "text/x-log" = emacs;
"text/x-lua" = emacs; "text/x-lua" = emacs;
"text/x-makefile" = emacs; "text/x-makefile" = emacs;
"text/x-cmake" = emacs;
"text/x-python" = emacs; "text/x-python" = emacs;
"text/x-python3" = emacs; "text/x-python3" = emacs;
"text/x-readme" = emacs; "text/x-readme" = emacs;
@ -40,6 +41,8 @@ in {
"application/xhtml+xml" = emacs; "application/xhtml+xml" = emacs;
"application/oxps" = emacs; "application/oxps" = emacs;
"application/x-shellscript" = emacs; "application/x-shellscript" = emacs;
"application/x-docbook+xml" = emacs;
"application/x-yaml" = emacs;
"application/pdf" = ["evince.desktop"]; "application/pdf" = ["evince.desktop"];
"application/epub+zip" = ["evince.desktop"]; "application/epub+zip" = ["evince.desktop"];
@ -58,6 +61,8 @@ in {
"x-scheme-handler/about" = browser; "x-scheme-handler/about" = browser;
"x-scheme-handler/chrome" = browser; "x-scheme-handler/chrome" = browser;
"x-scheme-handler/webcal" = browser; "x-scheme-handler/webcal" = browser;
"x-scheme-handler/geo" = ["openstreetmap-geo-handler.desktop"];
"x-scheme-handler/mailto" = ["emacsclient-mail.desktop"];
"x-scheme-handler/unknown" = emacs; "x-scheme-handler/unknown" = emacs;
"x-scheme-handler/prusaslicer" = ["PrusaSlicerURLProtocol.desktop"]; "x-scheme-handler/prusaslicer" = ["PrusaSlicerURLProtocol.desktop"];

View file

@ -104,13 +104,6 @@
}; };
}; };
startup.startupScript = {
"protonmail-bridge" = {
priority = 3;
text = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";
};
};
kwin = { kwin = {
virtualDesktops = { virtualDesktops = {
rows = 2; rows = 2;

View file

@ -3,6 +3,14 @@
hostname, hostname,
... ...
}: { }: {
home.packages = with pkgs; [
protonmail-bridge
(writeShellScriptBin "protonmail-bridge-setup" ''
systemctl --user stop protonmail-bridge
${protonmail-bridge}/bin/protonmail-bridge -c
systemctl --user restart protonmail-bridge
'')
];
accounts.email = { accounts.email = {
maildirBasePath = "Mail"; maildirBasePath = "Mail";
accounts = let accounts = let
@ -78,4 +86,17 @@
}; };
}; };
}; };
systemd.user.services.protonmail-bridge = {
Unit = {
Description = "Proton Mail Bridge";
Wants = ["network-online.target"];
After = ["network-online.target"];
};
Service = {
Environment = ["PATH=/run/current-system/sw/bin/:$PATH"];
Restart = "always";
ExecStart = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";
};
Install.WantedBy = ["default.target"];
};
} }

View file

@ -5,6 +5,14 @@
... ...
}: { }: {
imports = [./default.nix]; imports = [./default.nix];
home.packages = with pkgs; [
(writeShellScriptBin "davmail-setup" ''
systemctl --user restart davmail # Ensure config file is present
systemctl --user stop davmail
${davmail}/bin/davmail -n ~/.davmail.properties
systemctl --user restart davmail
'')
];
accounts.email.accounts.outlook = let accounts.email.accounts.outlook = let
host = "127.0.0.1"; host = "127.0.0.1";
tls.enable = false; tls.enable = false;