Use emacsclient to update mu index to make sure the db isn't locked

This commit is contained in:
Charlotte Van Petegem 2021-03-22 13:46:31 +01:00
parent 2808ce7436
commit 8e1b901372
No known key found for this signature in database
GPG key ID: 019E764B7184435A
6 changed files with 401 additions and 377 deletions

View file

@ -1,39 +1,42 @@
{ pkgs, ... }: { config, pkgs, ... }:
let let
launcher = import ./sway/launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; }; launcher = import ./sway/launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; };
status-configuration = import ./sway/status-configuration.nix { inherit pkgs; }; status-configuration = import ./sway/status-configuration.nix { inherit pkgs config; };
in in
{ {
imports = [ ./base-x.nix ]; imports = [ ./base-x.nix ];
home-manager.users.charlotte = { pkgs, ... }: {
xsession = { config = {
windowManager.i3 = { home-manager.users.charlotte = { pkgs, ... }: {
enable = true; xsession = {
config = { windowManager.i3 = {
bars = [ enable = true;
{ config = {
colors = { bars = [
background = "#fbffff"; {
statusline = "#535c65"; colors = {
focusedWorkspace = { background = "#2b7ab2"; border = "#2b7ab2"; text = "#fbffff"; }; background = "#fbffff";
activeWorkspace = { background = "#6d7782"; border = "#6d7782"; text = "#fbffff"; }; statusline = "#535c65";
inactiveWorkspace = { background = "#fbffff"; border = "#fbffff"; text = "535c65"; }; focusedWorkspace = { background = "#2b7ab2"; border = "#2b7ab2"; text = "#fbffff"; };
urgentWorkspace = { background = "#ae5865"; border = "#ae5865"; text = "#fbffff"; }; activeWorkspace = { background = "#6d7782"; border = "#6d7782"; text = "#fbffff"; };
}; inactiveWorkspace = { background = "#fbffff"; border = "#fbffff"; text = "535c65"; };
fonts = [ "Fira Code Normal 9" ]; urgentWorkspace = { background = "#ae5865"; border = "#ae5865"; text = "#fbffff"; };
position = "top"; };
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}"; fonts = [ "Fira Code Normal 9" ];
} position = "top";
]; statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}";
floating.criteria = [{ class = "launcher"; } { class = "accentor.Main"; }]; }
fonts = [ "Fira Code Normal 9" ]; ];
menu = "${pkgs.kitty}/bin/kitty --class launcher -e ${launcher}/bin/launcher"; floating.criteria = [{ class = "launcher"; } { class = "accentor.Main"; }];
modifier = "Mod4"; fonts = [ "Fira Code Normal 9" ];
terminal = "${pkgs.kitty}/bin/kitty"; menu = "${pkgs.kitty}/bin/kitty --class launcher -e ${launcher}/bin/launcher";
}; modifier = "Mod4";
extraConfig = '' terminal = "${pkgs.kitty}/bin/kitty";
};
extraConfig = ''
default_border pixel default_border pixel
''; '';
};
}; };
}; };
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
passwordScript = pkgs.writeShellScript "get_mail_password" ''${pkgs.pass}/bin/pass show "$@" | head -n1 | tr -d "\n"''; passwordScript = pkgs.writeShellScript "get_mail_password" ''${pkgs.pass}/bin/pass show "$@" | head -n1 | tr -d "\n"'';
notifyScript = name: pkgs.writeShellScript "notify_${name}_mail" '' notifyScript = name: pkgs.writeShellScript "notify_${name}_mail" ''
@ -28,7 +28,7 @@ let
enable = true; enable = true;
boxes = [ "INBOX" ]; boxes = [ "INBOX" ];
onNotify = "${pkgs.isync}/bin/mbsync ${name}:INBOX"; onNotify = "${pkgs.isync}/bin/mbsync ${name}:INBOX";
onNotifyPost = "${pkgs.mu}/bin/mu index && ${notifyScript name}"; onNotifyPost = "${config.chvp.emacs.package}/bin/emacsclient --eval \"(mu4e-update-index)\" && ${notifyScript name}";
}; };
mbsync = { mbsync = {
enable = true; enable = true;
@ -75,239 +75,241 @@ let
toRecursiveINIBase 1; toRecursiveINIBase 1;
in in
{ {
chvp.zfs.homeLinks = [ config = {
{ path = "mail"; type = "data"; } chvp.zfs.homeLinks = [
{ path = ".cache/mu"; type = "cache"; } { path = "mail"; type = "data"; }
{ path = ".local/share/contacts"; type = "cache"; } { path = ".cache/mu"; type = "cache"; }
{ path = ".local/share/calendars"; type = "cache"; } { path = ".local/share/contacts"; type = "cache"; }
{ path = ".local/share/vdirsyncer"; type = "cache"; } { path = ".local/share/calendars"; type = "cache"; }
]; { path = ".local/share/vdirsyncer"; type = "cache"; }
home-manager.users.charlotte = { ... }: { ];
accounts.email = { home-manager.users.charlotte = { ... }: {
maildirBasePath = "/data/home/charlotte/mail"; accounts.email = {
accounts = { maildirBasePath = "/data/home/charlotte/mail";
personal = makeAccount { accounts = {
name = "personal"; personal = makeAccount {
address = "charlotte@vanpetegem.me"; name = "personal";
host = "mail.vanpetegem.me"; address = "charlotte@vanpetegem.me";
passFile = "mail/Personal"; host = "mail.vanpetegem.me";
extraConfig = { passFile = "mail/Personal";
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; }; extraConfig = {
primary = true; folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; };
}; primary = true;
};
work = makeAccount {
name = "work";
address = "charlotte.vanpetegem@ugent.be";
imapHost = "outlook.office365.com";
smtpHost = "smtp.office365.com";
passFile = "work/UGentNet";
useStartTls = true;
extraConfig = {
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Deleted Items"; };
mbsync.extraConfig.account.PipelineDepth = "1";
};
};
work-aap-we-fr = makeAccount {
name = "work-aap-we-fr";
address = "aap-we-fr@ugent.be";
imapHost = "owa.ugent.be";
smtpHost = "smtp.ugent.be";
passFile = "work/UGentNet";
useStartTls = true;
extraConfig = {
folders = { drafts = "Concepten"; inbox = "INBOX"; sent = "Verzonden items"; trash = "Verwijderde items"; };
mbsync.extraConfig.account.PipelineDepth = "1";
userName = "UGENT\\\\ecvpeteg/aap-we-fr";
};
};
posteo = makeAccount {
name = "posteo";
address = "chvp@posteo.net";
host = "posteo.de";
passFile = "mail/Posteo";
extraConfig = {
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; };
};
};
jonggroen = makeAccount {
name = "jonggroen";
address = "charlotte@jonggroen.be";
imapHost = "imap.gmail.com";
smtpHost = "smtp.gmail.com";
passFile = "jonggroen/GoogleAppMail";
useStartTls = true;
extraConfig = {
flavor = "gmail.com";
folders = {
drafts = "[Gmail].Drafts";
inbox = "INBOX";
sent = "INBOX";
trash = "[Gmail].Bin";
}; };
}; };
}; work = makeAccount {
postbot = makeAccount { name = "work";
name = "postbot"; address = "charlotte.vanpetegem@ugent.be";
address = "postbot@vanpetegem.me"; imapHost = "outlook.office365.com";
host = "mail.vanpetegem.me"; smtpHost = "smtp.office365.com";
passFile = "mail/Postbot"; passFile = "work/UGentNet";
extraConfig = { useStartTls = true;
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; }; extraConfig = {
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Deleted Items"; };
mbsync.extraConfig.account.PipelineDepth = "1";
};
}; };
}; work-aap-we-fr = makeAccount {
webmaster = makeAccount { name = "work-aap-we-fr";
name = "webmaster"; address = "aap-we-fr@ugent.be";
address = "webmaster@vanpetegem.me"; imapHost = "owa.ugent.be";
host = "mail.vanpetegem.me"; smtpHost = "smtp.ugent.be";
passFile = "mail/Webmaster"; passFile = "work/UGentNet";
extraConfig = { useStartTls = true;
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; }; extraConfig = {
folders = { drafts = "Concepten"; inbox = "INBOX"; sent = "Verzonden items"; trash = "Verwijderde items"; };
mbsync.extraConfig.account.PipelineDepth = "1";
userName = "UGENT\\\\ecvpeteg/aap-we-fr";
};
};
posteo = makeAccount {
name = "posteo";
address = "chvp@posteo.net";
host = "posteo.de";
passFile = "mail/Posteo";
extraConfig = {
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; };
};
};
jonggroen = makeAccount {
name = "jonggroen";
address = "charlotte@jonggroen.be";
imapHost = "imap.gmail.com";
smtpHost = "smtp.gmail.com";
passFile = "jonggroen/GoogleAppMail";
useStartTls = true;
extraConfig = {
flavor = "gmail.com";
folders = {
drafts = "[Gmail].Drafts";
inbox = "INBOX";
sent = "INBOX";
trash = "[Gmail].Bin";
};
};
};
postbot = makeAccount {
name = "postbot";
address = "postbot@vanpetegem.me";
host = "mail.vanpetegem.me";
passFile = "mail/Postbot";
extraConfig = {
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; };
};
};
webmaster = makeAccount {
name = "webmaster";
address = "webmaster@vanpetegem.me";
host = "mail.vanpetegem.me";
passFile = "mail/Webmaster";
extraConfig = {
folders = { drafts = "Drafts"; inbox = "INBOX"; sent = "INBOX"; trash = "Trash"; };
};
}; };
}; };
}; };
}; home = {
home = { packages = [ pkgs.khal pkgs.khard ];
packages = [ pkgs.khal pkgs.khard ]; file.".mailcap".text = ''
file.".mailcap".text = '' text/html; ${pkgs.firefox}/bin/firefox %s ; nametemplate=%s.html; needsterminal
text/html; ${pkgs.firefox}/bin/firefox %s ; nametemplate=%s.html; needsterminal text/html; ${pkgs.w3m}/bin/w3m -dump -o display_link_number=1 -o document_charset=%{charset} %s ; copiousoutput; nametemplate=%s.html
text/html; ${pkgs.w3m}/bin/w3m -dump -o display_link_number=1 -o document_charset=%{charset} %s ; copiousoutput; nametemplate=%s.html text/calendar; ${pkgs.khal}/bin/khal import %s;
text/calendar; ${pkgs.khal}/bin/khal import %s; application/pdf; ${pkgs.okular}/bin/okular %s
application/pdf; ${pkgs.okular}/bin/okular %s image/png; ${pkgs.okular}/bin/okular %s
image/png; ${pkgs.okular}/bin/okular %s image/jpeg; ${pkgs.okular}/bin/okular %s
image/jpeg; ${pkgs.okular}/bin/okular %s '';
'';
};
xdg.configFile = {
"khal/config".text = toRecursiveINI {
calendars = {
calendar = {
path = "~/.local/share/calendars/*";
type = "discover";
};
};
locale = {
timeformat = "%H:%M";
dateformat = "%Y-%m-%d";
longdateformat = "%Y-%m-%d";
datetimeformat = "%Y-%m-%d %H:%M";
longdatetimeformat = "%Y-%m-%d %H:%M";
};
}; };
"khard/khard.conf".text = toRecursiveINI { xdg.configFile = {
addressbooks = { "khal/config".text = toRecursiveINI {
contacts = { calendars = {
path = "~/.local/share/contacts/contacts"; calendar = {
path = "~/.local/share/calendars/*";
type = "discover";
};
};
locale = {
timeformat = "%H:%M";
dateformat = "%Y-%m-%d";
longdateformat = "%Y-%m-%d";
datetimeformat = "%Y-%m-%d %H:%M";
longdatetimeformat = "%Y-%m-%d %H:%M";
}; };
}; };
general = { "khard/khard.conf".text = toRecursiveINI {
debug = "no"; addressbooks = {
default_action = "list"; contacts = {
editor = "emacs"; path = "~/.local/share/contacts/contacts";
merge_editor = "${pkgs.writeShellScript "ediff" ''emacs --eval "(ediff-merge-files \"$1\" \"$2\")"''}"; };
}; };
"contact table" = { general = {
display = "formatted_name"; debug = "no";
group_by_addressbook = "no"; default_action = "list";
reverse = "no"; editor = "emacs";
show_nicknames = "no"; merge_editor = "${pkgs.writeShellScript "ediff" ''emacs --eval "(ediff-merge-files \"$1\" \"$2\")"''}";
show_uids = "yes"; };
sort = "last_name"; "contact table" = {
localize_dates = "yes"; display = "formatted_name";
preferred_phone_number_type = "pref, cell, home"; group_by_addressbook = "no";
preferred_email_address_type = "pref, work, home"; reverse = "no";
}; show_nicknames = "no";
vcard = { show_uids = "yes";
private_objects = ","; sort = "last_name";
preferred_version = "4.0"; localize_dates = "yes";
search_in_source_files = "no"; preferred_phone_number_type = "pref, cell, home";
skip_unparsable = "no"; preferred_email_address_type = "pref, work, home";
};
vcard = {
private_objects = ",";
preferred_version = "4.0";
search_in_source_files = "no";
skip_unparsable = "no";
};
}; };
"vdirsyncer/config".text =
let nextcloudConfig = type: {
inherit type;
url = "https://nextcloud.vanpetegem.me/remote.php/dav/";
username = "chvp";
"password.fetch" = [ "command" "${passwordScript}" "social/Nextcloud" ];
}; in
lib.generators.toINI
{ mkKeyValue = lib.generators.mkKeyValueDefault { mkValueString = builtins.toJSON; } "="; }
{
general.status_path = "~/.local/share/vdirsyncer";
"pair nextcloud_contacts" = {
a = "nextcloud_contacts_local";
b = "nextcloud_contacts_remote";
collections = [ "from a" "from b" ];
};
"storage nextcloud_contacts_local" = {
type = "filesystem";
path = "~/.local/share/contacts";
fileext = ".vcf";
};
"storage nextcloud_contacts_remote" = nextcloudConfig "carddav";
"pair nextcloud_calendars" = {
a = "nextcloud_calendars_local";
b = "nextcloud_calendars_remote";
collections = [ "from a" "from b" ];
};
"storage nextcloud_calendars_local" = {
type = "filesystem";
path = "~/.local/share/calendars";
fileext = ".ics";
};
"storage nextcloud_calendars_remote" = nextcloudConfig "caldav";
};
};
programs = {
mbsync.enable = true;
msmtp.enable = true;
mu.enable = true;
}; };
"vdirsyncer/config".text =
let nextcloudConfig = type: {
inherit type;
url = "https://nextcloud.vanpetegem.me/remote.php/dav/";
username = "chvp";
"password.fetch" = [ "command" "${passwordScript}" "social/Nextcloud" ];
}; in
lib.generators.toINI
{ mkKeyValue = lib.generators.mkKeyValueDefault { mkValueString = builtins.toJSON; } "="; }
{
general.status_path = "~/.local/share/vdirsyncer";
"pair nextcloud_contacts" = {
a = "nextcloud_contacts_local";
b = "nextcloud_contacts_remote";
collections = [ "from a" "from b" ];
};
"storage nextcloud_contacts_local" = {
type = "filesystem";
path = "~/.local/share/contacts";
fileext = ".vcf";
};
"storage nextcloud_contacts_remote" = nextcloudConfig "carddav";
"pair nextcloud_calendars" = {
a = "nextcloud_calendars_local";
b = "nextcloud_calendars_remote";
collections = [ "from a" "from b" ];
};
"storage nextcloud_calendars_local" = {
type = "filesystem";
path = "~/.local/share/calendars";
fileext = ".ics";
};
"storage nextcloud_calendars_remote" = nextcloudConfig "caldav";
};
};
programs = {
mbsync.enable = true;
msmtp.enable = true;
mu.enable = true;
};
services = {
imapnotify.enable = true;
};
systemd.user = {
services = { services = {
mbsync = { imapnotify.enable = true;
Unit = {
Description = "MBSync email fetcher";
After = "network-online.target";
Wants = "network-online.target";
};
Service = {
Type = "oneshot";
ExecStart = [ "${pkgs.isync}/bin/mbsync -a" "${pkgs.mu}/bin/mu index" ];
};
};
vdirsyncer = {
Unit = {
Description = "VDirSyncer WebDAV syncer";
After = "network-online.target";
Wants = "network-online.target";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer sync";
};
};
}; };
timers = { systemd.user = {
mbsync = { services = {
Unit = { Description = "MBSync email fetcher"; }; mbsync = {
Timer = { Unit = {
OnCalendar = "*:0/5"; Description = "MBSync email fetcher";
Unit = "mbsync.service"; After = "network-online.target";
Wants = "network-online.target";
};
Service = {
Type = "oneshot";
ExecStart = [ "${pkgs.isync}/bin/mbsync -a" "${config.chvp.emacs.package}/bin/emacsclient --eval \"(mu4e-update-index)\"" ];
};
};
vdirsyncer = {
Unit = {
Description = "VDirSyncer WebDAV syncer";
After = "network-online.target";
Wants = "network-online.target";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer sync";
};
}; };
Install = { WantedBy = [ "timers.target" ]; };
}; };
vdirsyncer = { timers = {
Unit = { Description = "VDirSyncer WebDAV syncer"; }; mbsync = {
Timer = { Unit = { Description = "MBSync email fetcher"; };
OnCalendar = "*:0/5"; Timer = {
Unit = "vdirsyncer.service"; OnCalendar = "*:0/5";
Unit = "mbsync.service";
};
Install = { WantedBy = [ "timers.target" ]; };
};
vdirsyncer = {
Unit = { Description = "VDirSyncer WebDAV syncer"; };
Timer = {
OnCalendar = "*:0/5";
Unit = "vdirsyncer.service";
};
Install = { WantedBy = [ "timers.target" ]; };
}; };
Install = { WantedBy = [ "timers.target" ]; };
}; };
}; };
}; };

View file

@ -1,123 +1,124 @@
{ pkgs, ... }: { config, pkgs, ... }:
let let
launcher = import ./sway/launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; }; launcher = import ./sway/launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; };
color-picker = import ./sway/color-picker.nix { inherit pkgs; }; color-picker = import ./sway/color-picker.nix { inherit pkgs; };
screenshot = import ./sway/screenshot.nix { inherit pkgs; }; screenshot = import ./sway/screenshot.nix { inherit pkgs; };
status-configuration = import ./sway/status-configuration.nix { inherit pkgs; }; status-configuration = import ./sway/status-configuration.nix { inherit pkgs config; };
in in
{ {
services.dbus.packages = with pkgs; [ gnome3.dconf ]; config = {
security.pam.services.swaylock = { }; services.dbus.packages = with pkgs; [ gnome3.dconf ];
xdg.portal = { security.pam.services.swaylock = { };
enable = true; xdg.portal = {
gtkUsePortal = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];
};
home-manager.users.charlotte = { pkgs, lib, ... }: {
home.packages = [ color-picker screenshot ];
programs.mako = {
enable = true; enable = true;
font = "Fira Code Normal 9"; gtkUsePortal = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];
}; };
services.kanshi = { home-manager.users.charlotte = { pkgs, lib, ... }: {
enable = true; home.packages = [ color-picker screenshot ];
profiles = { programs.mako = {
"home-undocked" = { enable = true;
outputs = [ font = "Fira Code Normal 9";
{ criteria = "Unknown 0x2036 0x00000000"; position = "0,0"; mode = "2560x1440"; scale = 1.0; } };
]; services.kanshi = {
}; enable = true;
"home-docked" = { profiles = {
outputs = [ "home-undocked" = {
{ criteria = "Unknown 0x2036 0x00000000"; position = "0,0"; mode = "2560x1440"; scale = 1.0; } outputs = [
{ criteria = "Dell Inc. DELL U2718Q FN84K01T095L"; position = "2560,0"; mode = "3840x2160"; scale = 1.25; } { criteria = "Unknown 0x2036 0x00000000"; position = "0,0"; mode = "2560x1440"; scale = 1.0; }
]; ];
}; };
"work-undocked" = { "home-docked" = {
outputs = [ outputs = [
{ criteria = "Chimei Innolux Corporation 0x14D3 0x00000000"; position = "0,0"; mode = "1920x1080"; scale = 1.0; } { criteria = "Unknown 0x2036 0x00000000"; position = "0,0"; mode = "2560x1440"; scale = 1.0; }
]; { criteria = "Dell Inc. DELL U2718Q FN84K01T095L"; position = "2560,0"; mode = "3840x2160"; scale = 1.25; }
}; ];
"work-docked" = { };
outputs = [ "work-undocked" = {
{ criteria = "Chimei Innolux Corporation 0x14D3 0x00000000"; position = "0,0"; mode = "1920x1080"; scale = 1.0; } outputs = [
{ criteria = "Dell Inc. DELL U2718Q FN84K83Q1KHL"; position = "1920,0"; mode = "3840x2160"; scale = 1.25; } { criteria = "Chimei Innolux Corporation 0x14D3 0x00000000"; position = "0,0"; mode = "1920x1080"; scale = 1.0; }
]; ];
};
"work-docked" = {
outputs = [
{ criteria = "Chimei Innolux Corporation 0x14D3 0x00000000"; position = "0,0"; mode = "1920x1080"; scale = 1.0; }
{ criteria = "Dell Inc. DELL U2718Q FN84K83Q1KHL"; position = "1920,0"; mode = "3840x2160"; scale = 1.25; }
];
};
}; };
}; };
}; wayland.windowManager.sway = {
wayland.windowManager.sway = { enable = true;
enable = true; config = rec {
config = rec { modifier = "Mod4";
modifier = "Mod4"; left = "h";
left = "h"; down = "j";
down = "j"; up = "k";
up = "k"; right = "l";
right = "l"; terminal = "${pkgs.kitty}/bin/kitty";
terminal = "${pkgs.kitty}/bin/kitty"; menu = "${terminal} --class launcher -e ${launcher}/bin/launcher";
menu = "${terminal} --class launcher -e ${launcher}/bin/launcher"; bars = [
bars = [ {
{ colors = {
colors = { background = "#ffffff";
background = "#ffffff"; statusline = "#000000";
statusline = "#000000"; activeWorkspace = { border = "#f2eff3"; background = "#f2eff3"; text = "#000000"; };
activeWorkspace = { border = "#f2eff3"; background = "#f2eff3"; text = "#000000"; }; focusedWorkspace = { border = "#6aaeff"; background = "#6aaeff"; text = "#000000"; };
focusedWorkspace = { border = "#6aaeff"; background = "#6aaeff"; text = "#000000"; }; inactiveWorkspace = { border = "#ffffff"; background = "#ffffff"; text = "#000000"; };
inactiveWorkspace = { border = "#ffffff"; background = "#ffffff"; text = "#000000"; }; urgentWorkspace = { border = "#ff8892"; background = "#ff8892"; text = "#000000"; };
urgentWorkspace = { border = "#ff8892"; background = "#ff8892"; text = "#000000"; }; };
}; fonts = [ "Fira Code Normal 9" ];
fonts = [ "Fira Code Normal 9" ]; position = "top";
position = "top"; statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}"; extraConfig = ''
extraConfig = ''
status_padding 0 status_padding 0
icon_theme Arc icon_theme Arc
''; '';
} }
]; ];
output = { output = {
"Unknown 0x2036 0x00000000" = { position = "0,0"; mode = "2560x1440"; scale = "1.0"; }; "Unknown 0x2036 0x00000000" = { position = "0,0"; mode = "2560x1440"; scale = "1.0"; };
"Dell Inc. DELL U2718Q FN84K01T095L" = { position = "2560,0"; mode = "3840x2160"; scale = "1.25"; }; "Dell Inc. DELL U2718Q FN84K01T095L" = { position = "2560,0"; mode = "3840x2160"; scale = "1.25"; };
"Chimei Innolux Corporation 0x14D3 0x00000000" = { position = "0,0"; mode = "1920x1080"; scale = "1.0"; }; "Chimei Innolux Corporation 0x14D3 0x00000000" = { position = "0,0"; mode = "1920x1080"; scale = "1.0"; };
"Dell Inc. DELL U2718Q FN84K83Q1KHL" = { position = "1920,0"; mode = "3840x2160"; scale = "1.25"; }; "Dell Inc. DELL U2718Q FN84K83Q1KHL" = { position = "1920,0"; mode = "3840x2160"; scale = "1.25"; };
};
startup = [
{
command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' timeout 150 '${pkgs.sway}/bin/swaymsg \"output * dpms off\"' resume '${pkgs.sway}/bin/swaymsg \"output * dpms on\"' before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'";
}
];
window.commands = [
{ command = "floating enable"; criteria = { app_id = "launcher"; }; }
{ command = "floating enable"; criteria = { title = "Quick Format Citation"; class = "Zotero"; }; }
];
input = {
"type:keyboard" = { xkb_layout = "us"; xkb_variant = "altgr-intl"; xkb_numlock = "enabled"; xkb_options = "compose:caps"; };
"type:touchpad" = { drag = "enabled"; dwt = "enabled"; scroll_method = "two_finger"; tap = "enabled"; };
};
modes = { }; # Unset default "resize" mode
keybindings = lib.mkOptionDefault {
"${modifier}+Shift+q" = "nop Unset default kill";
"${modifier}+r" = "nop Unset default resize mode";
"${modifier}+Shift+c" = "kill";
"${modifier}+Shift+r" = "reload";
"${modifier}+c" = "exec ${pkgs.swaylock}/bin/swaylock -f -c 000000";
"${modifier}+i" = "inhibit_idle open; border normal; mark --add inhibiting_idle";
"${modifier}+Shift+i" = "inhibit_idle none; border pixel; unmark inhibiting_idle";
"Print" = "exec ${screenshot}/bin/screenshot";
"Alt+Print" = "exec ${screenshot}/bin/screenshot -d";
"Shift+Print" = "exec ${screenshot}/bin/screenshot -r";
"Alt+Shift+Print" = "exec ${screenshot}/bin/screenshot -r -d";
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
"${modifier}+Alt+Left" = "move workspace to output left";
"${modifier}+Alt+Right" = "move workspace to output right";
};
}; };
startup = [ extraConfig = ''
{
command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' timeout 150 '${pkgs.sway}/bin/swaymsg \"output * dpms off\"' resume '${pkgs.sway}/bin/swaymsg \"output * dpms on\"' before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'";
}
];
window.commands = [
{ command = "floating enable"; criteria = { app_id = "launcher"; }; }
{ command = "floating enable"; criteria = { title = "Quick Format Citation"; class = "Zotero"; }; }
];
input = {
"type:keyboard" = { xkb_layout = "us"; xkb_variant = "altgr-intl"; xkb_numlock = "enabled"; xkb_options = "compose:caps"; };
"type:touchpad" = { drag = "enabled"; dwt = "enabled"; scroll_method = "two_finger"; tap = "enabled"; };
};
modes = { }; # Unset default "resize" mode
keybindings = lib.mkOptionDefault {
"${modifier}+Shift+q" = "nop Unset default kill";
"${modifier}+r" = "nop Unset default resize mode";
"${modifier}+Shift+c" = "kill";
"${modifier}+Shift+r" = "reload";
"${modifier}+c" = "exec ${pkgs.swaylock}/bin/swaylock -f -c 000000";
"${modifier}+i" = "inhibit_idle open; border normal; mark --add inhibiting_idle";
"${modifier}+Shift+i" = "inhibit_idle none; border pixel; unmark inhibiting_idle";
"Print" = "exec ${screenshot}/bin/screenshot";
"Alt+Print" = "exec ${screenshot}/bin/screenshot -d";
"Shift+Print" = "exec ${screenshot}/bin/screenshot -r";
"Alt+Shift+Print" = "exec ${screenshot}/bin/screenshot -r -d";
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
"${modifier}+Alt+Left" = "move workspace to output left";
"${modifier}+Alt+Right" = "move workspace to output right";
};
};
extraConfig = ''
workspace 1 output eDP-1 workspace 1 output eDP-1
workspace 2 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 workspace 2 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 3 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 workspace 3 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
@ -140,7 +141,7 @@ in
default_border pixel default_border pixel
''; '';
extraSessionCommands = '' extraSessionCommands = ''
export XDG_SESSION_TYPE=wayland export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
@ -151,11 +152,12 @@ in
export MOZ_ENABLE_WAYLAND=1 export MOZ_ENABLE_WAYLAND=1
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
''; '';
wrapperFeatures = { wrapperFeatures = {
base = true; base = true;
gtk = true; gtk = true;
};
xwayland = true;
}; };
xwayland = true;
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { config, pkgs, ... }:
let let
mic-status = pkgs.writeShellScript "mic-status" '' mic-status = pkgs.writeShellScript "mic-status" ''
if [ "$(${pkgs.pulseaudio}/bin/pactl list sources | grep -o 'Mute: yes')" = "Mute: yes" ] if [ "$(${pkgs.pulseaudio}/bin/pactl list sources | grep -o 'Mute: yes')" = "Mute: yes" ]
@ -95,7 +95,7 @@ pkgs.writeText "configuration.toml" ''
json = true json = true
command = "${mail-status}" command = "${mail-status}"
interval = 1 interval = 1
on_click = "${pkgs.isync}/bin/mbsync -a" on_click = "${pkgs.isync}/bin/mbsync -a && ${config.chvp.emacs.package}/bin/emacsclient --eval \"(mu4e-update-index)\""
[[block]] [[block]]
block = "time" block = "time"

View file

@ -1,32 +1,49 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let
emacsPkg = pkgs.emacsWithPackagesFromUsePackage {
config = ./emacs/init.el;
package = pkgs.emacsPgtk;
alwaysEnsure = true;
extraEmacsPackages = epkgs: [
# mu4e is included in the mu package and should be used from there
pkgs.mu
];
};
in
{ {
options.chvp.emacs = { options.chvp.emacs = {
enable = lib.mkOption { enable = lib.mkOption {
default = true; default = true;
example = false; example = false;
}; };
package = lib.mkOption { };
}; };
config = lib.mkIf config.chvp.emacs.enable { config = lib.mkIf config.chvp.emacs.enable {
chvp = {
emacs.package = emacsPkg;
zfs.homeLinks = [
{ path = ".emacs.d"; type = "cache"; }
];
};
home-manager.users.charlotte = { ... }: { home-manager.users.charlotte = { ... }: {
programs.emacs = { services.emacs = {
enable = true; enable = true;
package = pkgs.emacsWithPackagesFromUsePackage { client.enable = true;
config = ./emacs/init.el; package = emacsPkg;
package = pkgs.emacsPgtk;
alwaysEnsure = true;
extraEmacsPackages = epkgs: [
# mu4e is included in the mu package and should be used from there
pkgs.mu
];
};
}; };
home = { home = {
file = { file = {
".emacs.d/early-init.el".source = ./emacs/early-init.el; ".emacs.d/early-init.el".source = ./emacs/early-init.el;
".emacs.d/init.el".source = ./emacs/init.el; ".emacs.d/init.el".source = ./emacs/init.el;
}; };
packages = [
(pkgs.writeShellScriptBin "emacs" ''
${emacsPkg}/bin/emacsclient -c $@
'')
];
sessionVariables = { EDITOR = "emacs"; }; sessionVariables = { EDITOR = "emacs"; };
}; };
}; };

View file

@ -35,7 +35,7 @@
"hv" '(describe-variable :which-key "variable") "hv" '(describe-variable :which-key "variable")
"q" '(:ignore t :which-key "quit") "q" '(:ignore t :which-key "quit")
"qq" '(save-buffers-kill-emacs :which-key "quit") "qq" '(delete-frame :which-key "quit")
"s" '(:ignore t :which-key "search") "s" '(:ignore t :which-key "search")
@ -394,14 +394,14 @@
(setq inhibit-startup-screen t) (setq inhibit-startup-screen t)
;; Font configuration ;; Font configuration
(when window-system (set-frame-font "Fira Code 9")) (defun font-settings ()
(defun emoji-fonts () "Setup font settings."
"Setup emoji font priorities." (when window-system (set-frame-font "Fira Code 9"))
(set-fontset-font t 'symbol "Noto Color Emoji") (set-fontset-font t 'symbol "Noto Color Emoji")
(set-fontset-font t 'symbol "Symbola" nil 'append)) (set-fontset-font t 'symbol "Symbola" nil 'append))
(if (daemonp) (if (daemonp)
(add-hook 'server-after-make-frame-hook #'emoji-fonts) (add-hook 'server-after-make-frame-hook #'font-settings)
(emoji-fonts)) (font-settings))
(provide 'init) (provide 'init)
;;; init.el ends here ;;; init.el ends here