Reorganize repository
This commit is contained in:
parent
da1824edb6
commit
0fc6c32a47
124 changed files with 16295 additions and 1229 deletions
64
modules/graphical/default.nix
Normal file
64
modules/graphical/default.nix
Normal file
|
@ -0,0 +1,64 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./firefox
|
||||
./gnupg
|
||||
./mail
|
||||
./pass
|
||||
./sound
|
||||
./sway
|
||||
./syncthing
|
||||
./terminal
|
||||
./theme
|
||||
./xdg
|
||||
];
|
||||
|
||||
options.chvp.graphical.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.enable {
|
||||
users.users.charlotte.extraGroups = [ "input" "video" ];
|
||||
chvp = {
|
||||
base = {
|
||||
emacs.extraConfig = [
|
||||
''
|
||||
;; Ligatures in GUI mode
|
||||
;; Should probably switch to ligature.el, but it isn't on MELPA (yet).
|
||||
(use-package fira-code-mode :config (when window-system (global-fira-code-mode)))
|
||||
|
||||
''
|
||||
];
|
||||
nix.unfreePackages = [ "google-chrome" ];
|
||||
};
|
||||
graphical = {
|
||||
firefox.enable = lib.mkDefault true;
|
||||
gnupg = {
|
||||
enable = lib.mkDefault true;
|
||||
pinentryFlavor = "qt";
|
||||
};
|
||||
mail.enable = lib.mkDefault true;
|
||||
pass.enable = lib.mkDefault true;
|
||||
sound.enable = lib.mkDefault true;
|
||||
sway.enable = lib.mkDefault true;
|
||||
syncthing.enable = lib.mkDefault true;
|
||||
terminal.enable = lib.mkDefault true;
|
||||
theme.enable = lib.mkDefault true;
|
||||
xdg.enable = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.charlotte = { ... }: {
|
||||
home.packages = with pkgs; [
|
||||
google-chrome
|
||||
mpv
|
||||
okular
|
||||
ranger
|
||||
ungoogled-chromium
|
||||
youtube-dl
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
19
modules/graphical/firefox/default.nix
Normal file
19
modules/graphical/firefox/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.firefox.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.firefox.enable {
|
||||
chvp.base.zfs.homeLinks = [
|
||||
{ path = ".cache/mozilla"; type = "cache"; }
|
||||
{ path = ".mozilla"; type = "data"; }
|
||||
];
|
||||
|
||||
home-manager.users.charlotte = { ... }: {
|
||||
home.packages = with pkgs; [ firefox ];
|
||||
};
|
||||
};
|
||||
}
|
41
modules/graphical/gnupg/default.nix
Normal file
41
modules/graphical/gnupg/default.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.gnupg = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
pinentryFlavor = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "curses";
|
||||
example = "qt";
|
||||
description = ''
|
||||
Pinentry flavor for gnupg.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.gnupg.enable {
|
||||
chvp.base.zfs.homeLinks = [
|
||||
{ path = ".gnupg"; type = "data"; }
|
||||
];
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
pinentryFlavor = config.chvp.graphical.gnupg.pinentryFlavor;
|
||||
};
|
||||
home-manager.users.charlotte = { lib, ... }: {
|
||||
home.activation.fixPermissionsCommands = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
mkdir -p /home/charlotte/.gnupg
|
||||
chmod u=rwX,go= /home/charlotte/.gnupg
|
||||
'';
|
||||
programs.gpg.enable = true;
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
defaultCacheTtl = 7200;
|
||||
maxCacheTtl = 99999;
|
||||
pinentryFlavor = config.chvp.graphical.gnupg.pinentryFlavor;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
438
modules/graphical/mail/default.nix
Normal file
438
modules/graphical/mail/default.nix
Normal file
|
@ -0,0 +1,438 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
passwordScript = pkgs.writeShellScript "get_mail_password" ''${pkgs.pass}/bin/pass show "$@" | head -n1 | tr -d "\n"'';
|
||||
notifyScript = name: pkgs.writeShellScript "notify_${name}_mail" ''
|
||||
unseen_count=$(${pkgs.mblaze}/bin/mlist -N ~/mail/*/INBOX | wc -l)
|
||||
|
||||
if [ "$unseen_count" = "1" ]
|
||||
then
|
||||
${pkgs.libnotify}/bin/notify-send -t 5000 'New ${name} mail arrived' "1 unseen mail"
|
||||
elif [ "$unseen_count" != "0" ]
|
||||
then
|
||||
${pkgs.libnotify}/bin/notify-send -t 5000 'New ${name} mail arrived' "$unseen_count unseen mails"
|
||||
fi
|
||||
'';
|
||||
makeAccount = { name, address, host ? "", imapHost ? host, smtpHost ? host, useStartTls ? false, passFile, extraConfig ? { } }: (lib.recursiveUpdate
|
||||
{
|
||||
inherit address;
|
||||
gpg = {
|
||||
key = "charlotte@vanpetegem.me";
|
||||
signByDefault = true;
|
||||
};
|
||||
imap = {
|
||||
host = imapHost;
|
||||
port = 993;
|
||||
tls.enable = true;
|
||||
};
|
||||
imapnotify = {
|
||||
enable = true;
|
||||
boxes = [ "INBOX" ];
|
||||
onNotify = "${pkgs.isync}/bin/mbsync ${name}:INBOX";
|
||||
onNotifyPost = "${config.chvp.base.emacs.package}/bin/emacsclient --eval \"(mu4e-update-index)\" && ${notifyScript name}";
|
||||
};
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "both";
|
||||
expunge = "both";
|
||||
flatten = ".";
|
||||
remove = "both";
|
||||
extraConfig.account.AuthMechs = "LOGIN";
|
||||
};
|
||||
msmtp.enable = true;
|
||||
mu.enable = true;
|
||||
passwordCommand = "${passwordScript} ${passFile}";
|
||||
realName = "Charlotte Van Petegem";
|
||||
signature = {
|
||||
showSignature = "none";
|
||||
};
|
||||
smtp = {
|
||||
host = smtpHost;
|
||||
port = if useStartTls then 587 else 465;
|
||||
tls = {
|
||||
enable = true;
|
||||
inherit useStartTls;
|
||||
};
|
||||
};
|
||||
userName = address;
|
||||
}
|
||||
extraConfig);
|
||||
toRecursiveINI = with lib.strings; with lib.attrsets; with lib.generators; with lib.lists; let
|
||||
repeat = count: char: concatStrings (genList (_: char) count);
|
||||
mkHeader = depth: name: concatStrings [ (repeat depth "[") (escape [ "[" ] name) (repeat depth "]") ];
|
||||
simpleAttrs = filterAttrs (n: v: !(isAttrs v));
|
||||
complexAttrs = filterAttrs (n: v: isAttrs v);
|
||||
removeEmpty = filter (v: v != "");
|
||||
toRecursiveINIBase = depth: data: (concatStringsSep "\n" (
|
||||
mapAttrsToList
|
||||
(name: values: concatStringsSep "\n" (removeEmpty [
|
||||
(mkHeader depth name)
|
||||
(toKeyValue { } (simpleAttrs values))
|
||||
(toRecursiveINIBase (depth + 1) (complexAttrs values))
|
||||
]))
|
||||
data
|
||||
));
|
||||
in
|
||||
toRecursiveINIBase 1;
|
||||
in
|
||||
{
|
||||
options.chvp.graphical.mail.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.mail.enable {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
khal = super.khal.overrideAttrs (old: { doInstallCheck = false; });
|
||||
})
|
||||
];
|
||||
chvp = {
|
||||
base = {
|
||||
emacs.extraConfig =
|
||||
let
|
||||
mkAccountConfig = account: ''
|
||||
(make-mu4e-context
|
||||
:name "${account.name}"
|
||||
:match-func (lambda (msg) (when msg (string-prefix-p "/${account.maildir.path}/" (mu4e-message-field msg :maildir))))
|
||||
:vars '(
|
||||
(user-mail-address . "${account.address}")
|
||||
(user-full-name . "${account.realName}")
|
||||
(mu4e-drafts-folder . "/${account.maildir.path}/${account.folders.drafts}")
|
||||
(mu4e-sent-folder . "/${account.maildir.path}/${account.folders.sent}")
|
||||
(mu4e-refile-folder . "/${account.maildir.path}/${account.folders.trash}")
|
||||
(mu4e-trash-folder . "/${account.maildir.path}/${account.folders.trash}")
|
||||
(message-sendmail-extra-arguments . ("--read-envelope-from" "--account" "${account.name}"))
|
||||
)
|
||||
)
|
||||
'';
|
||||
hmConfig = config.home-manager.users.charlotte;
|
||||
in
|
||||
[
|
||||
''
|
||||
(use-package mu4e
|
||||
;; Use mu4e included in the mu package, see emacs.nix
|
||||
:ensure nil
|
||||
:demand t
|
||||
:after (selectrum)
|
||||
:hook
|
||||
(mu4e-view-mode . display-line-numbers-mode)
|
||||
(mu4e-compose-mode . mail/auto-dodona-cc-reply-to)
|
||||
:custom
|
||||
(mu4e-change-filenames-when-moving t "Avoid sync issues with mbsync")
|
||||
(mu4e-maildir "${hmConfig.accounts.email.maildirBasePath}" "Root of the maildir hierarchy")
|
||||
(mu4e-context-policy 'pick-first "Use the first mail context in the list")
|
||||
(mu4e-attachment-dir "/home/charlotte/downloads/" "Save attachments to downloads folder")
|
||||
(mu4e-compose-dont-reply-to-self t "Don't reply to myself on reply to all")
|
||||
(mu4e-confirm-quit nil "Don't confirm when quitting")
|
||||
(mu4e-completing-read-function 'completing-read "Use default completing read function")
|
||||
(mu4e-headers-include-related nil "Don't show related messages by default")
|
||||
(mu4e-headers-skip-duplicates nil "Show duplicate emails")
|
||||
(message-kill-buffer-on-exit t "Close buffer when finished with email")
|
||||
(mm-verify-option 'known "Always verify PGP signatures (known protocols)")
|
||||
(mm-discouraged-alternatives '("text/html" "text/richtext") "Discourage showing HTML views")
|
||||
(gnus-buttonized-mime-types '("multipart/signed") "Make sure signature verification is always shown")
|
||||
(sendmail-program "msmtp" "Use msmtp to send email")
|
||||
(message-sendmail-f-is-evil t "Remove username from the emacs message")
|
||||
(message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail to send mail instead internal smtp")
|
||||
(message-cite-reply-position 'below "Bottom posting is the correct way to reply to email")
|
||||
:config
|
||||
(setq mu4e-contexts (list ${lib.concatStringsSep "\n" (map mkAccountConfig (lib.attrValues hmConfig.accounts.email.accounts))}))
|
||||
(add-to-list
|
||||
'mu4e-bookmarks
|
||||
'(:name "Combined inbox" :query "maildir:/personal/INBOX or maildir:/work/INBOX or maildir:/posteo/INBOX or maildir:/jonggroen/INBOX" :key ?i)
|
||||
)
|
||||
(define-advice mu4e~context-ask-user
|
||||
(:around (orig-fun &rest args) mu4e~context-ask-user-completing-read)
|
||||
"Replace `mu4e-read-option` by general-purpose completing-read"
|
||||
(cl-letf (((symbol-function 'mu4e-read-option)
|
||||
(lambda (prompt options)
|
||||
(let* ((prompt (mu4e-format "%s" prompt))
|
||||
(choice (completing-read prompt (cl-mapcar #'car options) nil t))
|
||||
(chosen-el (cl-find-if (lambda (option) (equal choice (car option))) options)))
|
||||
(if chosen-el
|
||||
(cdr chosen-el)
|
||||
(mu4e-warn "Unknown option: '%s'" choice))))))
|
||||
(apply orig-fun args)))
|
||||
(define-skeleton mail/dodona-teacher-reply-skeleton
|
||||
"Inserts a typical reply when someone uses the general form for a Dodona teacher request."
|
||||
"Naam leerkracht: "
|
||||
"Dag " str ",\n"
|
||||
"\n"
|
||||
_
|
||||
"\n"
|
||||
"Welkom op Dodona! Zou je het volgende formulier kunnen invullen?\n"
|
||||
"\n"
|
||||
"https://dodona.ugent.be/rights_requests/new/\n"
|
||||
"\n"
|
||||
"Zo hebben we meteen alle info die we nodig hebben om je "
|
||||
"lesgeversrechten te geven op Dodona.\n"
|
||||
"\n"
|
||||
"Met vriendelijke groeten,\n"
|
||||
"Charlotte Van Petegem"
|
||||
)
|
||||
(defun mail/dodona-cc-reply-to ()
|
||||
"Add dodona@ugent.be in cc and reply-to headers."
|
||||
(interactive)
|
||||
(save-excursion (message-add-header "Cc: dodona@ugent.be\nReply-To: dodona@ugent.be\n"))
|
||||
)
|
||||
(defun mail/auto-dodona-cc-reply-to ()
|
||||
"Set dodona@ugent.be in CC and Reply-To headers when message was directed to dodona@ugent.be"
|
||||
(let ((msg mu4e-compose-parent-message))
|
||||
(when (and msg (mu4e-message-contact-field-matches msg :to "dodona@ugent.be")) (mail/dodona-cc-reply-to))
|
||||
)
|
||||
)
|
||||
:general
|
||||
(lmap "m" '(mu4e :which-key "mail"))
|
||||
;; Unmap SPC in the mail view so we can still use the leader.
|
||||
(lmap mu4e-view-mode-map "" nil)
|
||||
(lmap mu4e-compose-mode-map
|
||||
"SPC s" '(mml-secure-message-sign-pgpmime :which-key "Sign")
|
||||
"SPC c" '(mml-secure-message-encrypt-pgpmime :which-key "Encrypt")
|
||||
"SPC t" '(mail/dodona-teacher-reply-skeleton :which-key "Teacher rights reply")
|
||||
"SPC d" '(mail/dodona-cc-reply-to :which-key "Dodona support headers")
|
||||
)
|
||||
)
|
||||
''
|
||||
];
|
||||
zfs.homeLinks = [
|
||||
{ path = "mail"; type = "data"; }
|
||||
{ path = ".cache/mu"; type = "cache"; }
|
||||
{ path = ".local/share/contacts"; type = "cache"; }
|
||||
{ path = ".local/share/calendars"; type = "cache"; }
|
||||
{ path = ".local/share/vdirsyncer"; type = "cache"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
home-manager.users.charlotte = { ... }: {
|
||||
accounts.email = {
|
||||
maildirBasePath = "/data/home/charlotte/mail";
|
||||
accounts = {
|
||||
personal = makeAccount {
|
||||
name = "personal";
|
||||
address = "charlotte@vanpetegem.me";
|
||||
host = "mail.vanpetegem.me";
|
||||
passFile = "mail/Personal";
|
||||
extraConfig = {
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
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 = {
|
||||
packages = [ pkgs.khal pkgs.khard ];
|
||||
file.".mailcap".text = ''
|
||||
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/calendar; ${pkgs.khal}/bin/khal import %s;
|
||||
application/pdf; ${pkgs.okular}/bin/okular %s
|
||||
image/png; ${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 {
|
||||
addressbooks = {
|
||||
contacts = {
|
||||
path = "~/.local/share/contacts/contacts";
|
||||
};
|
||||
};
|
||||
general = {
|
||||
debug = "no";
|
||||
default_action = "list";
|
||||
editor = "emacs";
|
||||
merge_editor = "${pkgs.writeShellScript "ediff" ''emacs --eval "(ediff-merge-files \"$1\" \"$2\")"''}";
|
||||
};
|
||||
"contact table" = {
|
||||
display = "formatted_name";
|
||||
group_by_addressbook = "no";
|
||||
reverse = "no";
|
||||
show_nicknames = "no";
|
||||
show_uids = "yes";
|
||||
sort = "last_name";
|
||||
localize_dates = "yes";
|
||||
preferred_phone_number_type = "pref, cell, home";
|
||||
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;
|
||||
};
|
||||
services = {
|
||||
imapnotify.enable = true;
|
||||
};
|
||||
systemd.user = {
|
||||
services = {
|
||||
mbsync = {
|
||||
Unit = {
|
||||
Description = "MBSync email fetcher";
|
||||
After = "network-online.target";
|
||||
Wants = "network-online.target";
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = [ "${pkgs.isync}/bin/mbsync -a" "${config.chvp.base.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";
|
||||
};
|
||||
};
|
||||
};
|
||||
timers = {
|
||||
mbsync = {
|
||||
Unit = { Description = "MBSync email fetcher"; };
|
||||
Timer = {
|
||||
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" ]; };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
36
modules/graphical/pass/default.nix
Normal file
36
modules/graphical/pass/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.pass.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.pass.enable {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
firefox = super.firefox.override { extraNativeMessagingHosts = [ self.passff-host ]; };
|
||||
pass = (super.pass.override { pass = super.pass-wayland; }).withExtensions (ext: [ ext.pass-otp ]);
|
||||
})
|
||||
];
|
||||
|
||||
chvp.base.emacs.extraConfig = [
|
||||
''
|
||||
(use-package auth-source-pass
|
||||
:ensure nil
|
||||
:custom
|
||||
(auth-sources '(password-store))
|
||||
(auth-source-pass-filename "${config.home-manager.users.charlotte.programs.password-store.settings.PASSWORD_STORE_DIR}")
|
||||
)
|
||||
''
|
||||
];
|
||||
|
||||
home-manager.users.charlotte = { ... }: {
|
||||
programs.password-store = {
|
||||
enable = true;
|
||||
settings = { PASSWORD_STORE_DIR = "/home/charlotte/repos/passwords"; };
|
||||
};
|
||||
services.password-store-sync.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
29
modules/graphical/sound/default.nix
Normal file
29
modules/graphical/sound/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.sound.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.sound.enable {
|
||||
chvp.base.zfs.homeLinks = [
|
||||
{ path = ".config/pipewire"; type = "cache"; }
|
||||
];
|
||||
|
||||
home-manager.users.charlotte = { ... }: {
|
||||
home.packages = with pkgs; [
|
||||
pavucontrol
|
||||
qjackctl
|
||||
];
|
||||
};
|
||||
|
||||
sound.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
jack.enable = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
7
modules/graphical/sway/color-picker.nix
Normal file
7
modules/graphical/sway/color-picker.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellScriptBin "color_picker" ''
|
||||
color=$(${pkgs.grim}/bin/grim -t png -g "$(${pkgs.slurp}/bin/slurp -p)" - | ${pkgs.imagemagick}/bin/convert png:- -unique-colors txt:- | grep -o '#[A-F0-9]\+')
|
||||
|
||||
${pkgs.sway}/bin/swaymsg exec -- "echo -n '$color' | ${pkgs.wl-clipboard}/bin/wl-copy --foreground"
|
||||
''
|
177
modules/graphical/sway/default.nix
Normal file
177
modules/graphical/sway/default.nix
Normal file
|
@ -0,0 +1,177 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
launcher = import ./launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; };
|
||||
color-picker = import ./color-picker.nix { inherit pkgs; };
|
||||
screenshot = import ./screenshot.nix { inherit pkgs; };
|
||||
status-configuration = import ./status-configuration.nix { inherit pkgs config; };
|
||||
in
|
||||
{
|
||||
options.chvp.graphical.sway.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.sway.enable {
|
||||
services.dbus.packages = with pkgs; [ gnome3.dconf ];
|
||||
security.pam.services.swaylock = { };
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
gtkUsePortal = true;
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];
|
||||
};
|
||||
home-manager.users.charlotte = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
color-picker
|
||||
screenshot
|
||||
wf-recorder
|
||||
wl-clipboard
|
||||
];
|
||||
programs = {
|
||||
mako = {
|
||||
enable = true;
|
||||
font = "Fira Code Normal 9";
|
||||
};
|
||||
zsh.loginExtra = ''
|
||||
if [[ -z "$DISPLAY" ]] && [[ $(tty) = "/dev/tty1" ]]; then
|
||||
exec sway
|
||||
fi
|
||||
'';
|
||||
};
|
||||
services.kanshi = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
"home-undocked" = {
|
||||
outputs = [
|
||||
{ criteria = "Unknown 0x2036 0x00000000"; position = "0,0"; mode = "2560x1440"; scale = 1.0; }
|
||||
];
|
||||
};
|
||||
"home-docked" = {
|
||||
outputs = [
|
||||
{ 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.0; }
|
||||
];
|
||||
};
|
||||
"work-undocked" = {
|
||||
outputs = [
|
||||
{ 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.0; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
config = rec {
|
||||
modifier = "Mod4";
|
||||
left = "h";
|
||||
down = "j";
|
||||
up = "k";
|
||||
right = "l";
|
||||
terminal = "${pkgs.kitty}/bin/kitty";
|
||||
menu = "${terminal} --class launcher -e ${launcher}/bin/launcher";
|
||||
fonts = { names = [ "Fira Code" ]; size = 9.0; style = "Normal"; };
|
||||
bars = [
|
||||
{
|
||||
colors = {
|
||||
background = "#ffffff";
|
||||
statusline = "#000000";
|
||||
activeWorkspace = { border = "#f2eff3"; background = "#f2eff3"; text = "#000000"; };
|
||||
focusedWorkspace = { border = "#6aaeff"; background = "#6aaeff"; text = "#000000"; };
|
||||
inactiveWorkspace = { border = "#ffffff"; background = "#ffffff"; text = "#000000"; };
|
||||
urgentWorkspace = { border = "#ff8892"; background = "#ff8892"; text = "#000000"; };
|
||||
};
|
||||
fonts = { names = [ "Fira Code" ]; size = 9.0; style = "Normal"; };
|
||||
position = "top";
|
||||
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}";
|
||||
extraConfig = ''
|
||||
status_padding 0
|
||||
icon_theme Arc
|
||||
'';
|
||||
}
|
||||
];
|
||||
output = {
|
||||
"Unknown 0x2036 0x00000000" = { position = "0,0"; mode = "2560x1440"; scale = "1.0"; };
|
||||
"Dell Inc. DELL U2718Q FN84K01T095L" = { position = "2560,0"; mode = "3840x2160"; 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.0"; };
|
||||
};
|
||||
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";
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
workspace 1 output 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 4 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
|
||||
workspace 5 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
|
||||
workspace 6 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
|
||||
workspace 7 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
|
||||
workspace 8 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
|
||||
workspace 9 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
|
||||
|
||||
workspace 1
|
||||
exec ${pkgs.firefox}/bin/firefox
|
||||
|
||||
no_focus [title="Microsoft Teams Notification"]
|
||||
|
||||
default_border pixel
|
||||
'';
|
||||
extraSessionCommands = ''
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
||||
export QT_SCALE_FACTOR=1
|
||||
export GDK_SCALE=1
|
||||
export GDK_DPI_SCALE=1
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
'';
|
||||
wrapperFeatures = {
|
||||
base = true;
|
||||
gtk = true;
|
||||
};
|
||||
xwayland = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
52
modules/graphical/sway/launcher.nix
Normal file
52
modules/graphical/sway/launcher.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ pkgs, stdenv }:
|
||||
let
|
||||
gemoji = pkgs.buildRubyGem {
|
||||
pname = "gemoji";
|
||||
gemName = "gemoji";
|
||||
source.sha256 = "1xv38sxql1fmaxi5lzj6v98l2aqhi6bqkhi6kqd0k38vw40l3yqc";
|
||||
type = "gem";
|
||||
version = "4.0.0.rc2";
|
||||
};
|
||||
emojiList = stdenv.mkDerivation {
|
||||
name = "emoji_list";
|
||||
buildInputs = [ pkgs.ruby gemoji ];
|
||||
unpackPhase = "true";
|
||||
buildPhase = ''
|
||||
cat > extract_emoji.rb <<HERE
|
||||
require 'emoji'
|
||||
File.open('emoji_list.txt', 'w') do |f|
|
||||
Emoji.all.each do |e|
|
||||
f.puts("#{e.raw} #{e.description} #{e.name}#{(" " + e.tags.join(" ")) if e.tags.any?} (#{e.category})")
|
||||
end
|
||||
end
|
||||
HERE
|
||||
ruby extract_emoji.rb
|
||||
'';
|
||||
installPhase = ''
|
||||
cp emoji_list.txt $out
|
||||
'';
|
||||
};
|
||||
script = pkgs.substituteAll {
|
||||
src = ./launcher.zsh;
|
||||
inherit (pkgs)
|
||||
fzy
|
||||
jq
|
||||
kitty
|
||||
libqalculate
|
||||
pass
|
||||
slurp
|
||||
sway
|
||||
tmuxinator
|
||||
zsh
|
||||
;
|
||||
inherit emojiList;
|
||||
wfRecorder = pkgs.wf-recorder;
|
||||
wlClipboard = pkgs.wl-clipboard;
|
||||
xdgUserDirs = pkgs.xdg-user-dirs;
|
||||
};
|
||||
in
|
||||
pkgs.runCommandNoCC "launcher" { } ''
|
||||
mkdir -p $out/bin
|
||||
cp ${script} $out/bin/launcher
|
||||
chmod +x $out/bin/launcher
|
||||
''
|
124
modules/graphical/sway/launcher.zsh
Normal file
124
modules/graphical/sway/launcher.zsh
Normal file
|
@ -0,0 +1,124 @@
|
|||
#!@zsh@/bin/zsh
|
||||
|
||||
_sighandler() {
|
||||
kill -INT "$child" 2>/dev/null
|
||||
}
|
||||
|
||||
calc_options() {
|
||||
echo "calc "
|
||||
}
|
||||
|
||||
calc() {
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
@libqalculate@/bin/qalc "$1"
|
||||
sleep 5
|
||||
else
|
||||
@libqalculate@/bin/qalc
|
||||
fi
|
||||
}
|
||||
|
||||
emoji_options() {
|
||||
cat @emojiList@ | sed "s/^/emoji /"
|
||||
}
|
||||
|
||||
emoji() {
|
||||
char=$(echo -n "$1" | sed "s/^\([^ ]*\) .*/\1/")
|
||||
@sway@/bin/swaymsg exec -- "echo -n $char | @wlClipboard@/bin/wl-copy --foreground"
|
||||
}
|
||||
|
||||
pass_options(){
|
||||
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
||||
password_files=( "$prefix"/**/*.gpg )
|
||||
printf 'password %s\n' ${${password_files%.gpg}#$prefix/}
|
||||
printf 'username %s\n' ${${password_files%.gpg}#$prefix/}
|
||||
printf 'otp %s\n' ${${password_files%.gpg}#$prefix/}
|
||||
}
|
||||
|
||||
username() {
|
||||
swaymsg exec -- "@pass@/bin/pass show '$@' | sed -n 's/^Username: *//p' | tr -d '\n' | @wlClipboard@/bin/wl-copy --foreground"
|
||||
}
|
||||
password() {
|
||||
swaymsg exec -- "@pass@/bin/pass show -c0 '$@'"
|
||||
}
|
||||
otp() {
|
||||
swaymsg exec -- "@pass@/bin/pass otp -c '$@'"
|
||||
}
|
||||
|
||||
record_options() {
|
||||
@sway@/bin/swaymsg -t get_outputs | @jq@/bin/jq -r '.[]["name"]' | sed "s/^/record /"
|
||||
echo record select
|
||||
}
|
||||
|
||||
record() {
|
||||
filename="$(@xdgUserDirs@/bin/xdg-user-dir VIDEOS)/$(date +'screenrecording_%y-%m-%d-%H%M%S.mp4')"
|
||||
|
||||
trap _sighandler SIGINT
|
||||
if [[ "$1" = "select" ]]
|
||||
then
|
||||
@wfRecorder@/bin/wf-recorder -g "$(@slurp@/bin/slurp)" -f "$filename" &
|
||||
else
|
||||
@wfRecorder@/bin/wf-recorder -o $! -f "$filename" &
|
||||
fi
|
||||
child=$!
|
||||
wait "$child"
|
||||
# We wait two times, because the first wait exits when the process receives a signal. The process might have finished though, so we ignore errors.
|
||||
wait "$child" 2>/dev/null
|
||||
if [ -f "$filename" ]
|
||||
then
|
||||
echo "Saved as $filename"
|
||||
else
|
||||
echo "Something went wrong while recording"
|
||||
fi
|
||||
sleep 5
|
||||
}
|
||||
|
||||
run_options() {
|
||||
print -rl -- ''${(ko)commands} | sed "s/^/run /"
|
||||
}
|
||||
|
||||
run() {
|
||||
@sway@/bin/swaymsg exec $1
|
||||
}
|
||||
|
||||
ssh_options() {
|
||||
cat $HOME/.ssh/config | grep "^Host [a-zA-Z]\+" | sed "s/Host /ssh /"
|
||||
}
|
||||
|
||||
ssh() {
|
||||
@sway@/bin/swaymsg exec "@kitty@/bin/kitty -e ssh $1"
|
||||
}
|
||||
|
||||
systemctl_options() {
|
||||
echo systemctl hibernate
|
||||
echo systemctl poweroff
|
||||
echo systemctl reboot
|
||||
echo systemctl suspend
|
||||
}
|
||||
|
||||
tmuxinator_options() {
|
||||
ls ~/.config/tmuxinator | sed "s/\.yml$//" | sed "s/^/tmuxinator /"
|
||||
}
|
||||
|
||||
tmuxinator() {
|
||||
@sway@/bin/swaymsg exec "@kitty@/bin/kitty -e @tmuxinator@/bin/tmuxinator start $1"
|
||||
}
|
||||
|
||||
windows_options() {
|
||||
@sway@/bin/swaymsg -t get_tree | @jq@/bin/jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.layout=="none")|select(.app_id!="launcher")|select(.type=="con"),select(.type=="floating_con")|(if .app_id then .app_id else .window_properties.class end)+": "+.name+" ("+(.id|tostring)+")"' | sed "s/^/windows /"
|
||||
}
|
||||
|
||||
windows() {
|
||||
window=$(echo $@ | sed 's/.* (\([^)]*\))$/\1/')
|
||||
@sway@/bin/swaymsg \[con_id="$window"\] focus
|
||||
}
|
||||
|
||||
CHOSEN=$(cat <(windows_options) <(tmuxinator_options) <(ssh_options) <(systemctl_options) <(pass_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | @fzy@/bin/fzy --lines 36 | tail -n1)
|
||||
|
||||
if [ -n "$CHOSEN" ]
|
||||
then
|
||||
PREFIX=$(echo $CHOSEN | sed "s/^\([^ ]*\) .*/\1/g")
|
||||
WORD=$(echo $CHOSEN | sed "s/^[^ ]* \(.*\)/\1/g")
|
||||
|
||||
$PREFIX $WORD
|
||||
fi
|
36
modules/graphical/sway/screenshot.nix
Normal file
36
modules/graphical/sway/screenshot.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellScriptBin "screenshot" ''
|
||||
while getopts ":rd" opt
|
||||
do
|
||||
case "''${opt}" in
|
||||
r)
|
||||
remote=true
|
||||
;;
|
||||
d)
|
||||
delay=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
dims="$(${pkgs.slurp}/bin/slurp)"
|
||||
|
||||
if [[ -n "$delay" ]]
|
||||
then
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [[ -n "$remote" ]]
|
||||
then
|
||||
name=$(${pkgs.utillinux}/bin/uuidgen).png
|
||||
${pkgs.grim}/bin/grim -t png -g "$dims" - | ${pkgs.openssh}/bin/ssh data "cat > data/public/$name"
|
||||
path="https://data.vanpetegem.me/public/$name"
|
||||
else
|
||||
name=$(date +'screenshot_%Y-%m-%d-%H%M%S.png')
|
||||
path="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)/$name"
|
||||
${pkgs.grim}/bin/grim -g "$dims" "$path"
|
||||
fi
|
||||
|
||||
${pkgs.sway}/bin/swaymsg exec -- "echo -n '$path' | ${pkgs.wl-clipboard}/bin/wl-copy --foreground"
|
||||
${pkgs.libnotify}/bin/notify-send "Screenshot taken" "$path"
|
||||
''
|
94
modules/graphical/sway/status-configuration.nix
Normal file
94
modules/graphical/sway/status-configuration.nix
Normal file
|
@ -0,0 +1,94 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
mic-status = pkgs.writeShellScript "mic-status" ''
|
||||
if [ "$(${pkgs.pulseaudio}/bin/pactl list sources | grep -o 'Mute: yes')" = "Mute: yes" ]
|
||||
then
|
||||
echo -e '\uf131'
|
||||
else
|
||||
echo -e '\uf130'
|
||||
fi
|
||||
'';
|
||||
mail-status = pkgs.writeShellScript "mail-status" ''
|
||||
mails=$(${pkgs.mblaze}/bin/mlist -N ~/mail/*/INBOX | wc -l)
|
||||
if [ "$mails" -gt 0 ]
|
||||
then
|
||||
echo "{ \"state\": \"Info\", \"text\": \" 📬 $mails\" }"
|
||||
else
|
||||
echo "{ \"state\": \"Idle\", \"text\": \" 📭 $mails\" }"
|
||||
fi
|
||||
'';
|
||||
in
|
||||
pkgs.writeText "configuration.toml" ''
|
||||
[theme]
|
||||
name = "gruvbox-light"
|
||||
[theme.overrides]
|
||||
idle_bg="#ffffff"
|
||||
idle_fg="#000000"
|
||||
info_bg="#6aaeff"
|
||||
info_fg="#000000"
|
||||
good_bg="#5ada88"
|
||||
good_fg="#000000"
|
||||
warning_bg="#f5df23"
|
||||
warning_fg="#000000"
|
||||
critical_bg="#ff8892"
|
||||
critical_fg="#000000"
|
||||
separator=""
|
||||
|
||||
[icons]
|
||||
name = "awesome"
|
||||
|
||||
[[block]]
|
||||
block = "net"
|
||||
device = "wlp2s0"
|
||||
format = "{ssid}"
|
||||
hide_missing = true
|
||||
hide_inactive = true
|
||||
|
||||
[[block]]
|
||||
block = "net"
|
||||
device = "wlp0s20f3"
|
||||
format = "{ssid}"
|
||||
hide_missing = true
|
||||
hide_inactive = true
|
||||
|
||||
[[block]]
|
||||
block = "net"
|
||||
device = "enp0s31f6"
|
||||
format = "{ip}"
|
||||
hide_missing = true
|
||||
hide_inactive = true
|
||||
|
||||
[[block]]
|
||||
block = "net"
|
||||
device = "enp0s20f0u1u2"
|
||||
format = "{ip}"
|
||||
hide_missing = true
|
||||
hide_inactive = true
|
||||
|
||||
[[block]]
|
||||
block = "battery"
|
||||
|
||||
[[block]]
|
||||
block = "backlight"
|
||||
|
||||
[[block]]
|
||||
block = "sound"
|
||||
|
||||
[[block]]
|
||||
block = "custom"
|
||||
command = "${mic-status}"
|
||||
interval = 1
|
||||
on_click = "${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"
|
||||
|
||||
[[block]]
|
||||
block = "custom"
|
||||
json = true
|
||||
command = "${mail-status}"
|
||||
interval = 1
|
||||
on_click = "${pkgs.isync}/bin/mbsync -a && ${config.chvp.base.emacs.package}/bin/emacsclient --eval \"(mu4e-update-index)\""
|
||||
|
||||
[[block]]
|
||||
block = "time"
|
||||
interval = 1
|
||||
format = "%a %d/%m %H:%M"
|
||||
''
|
18
modules/graphical/syncthing/default.nix
Normal file
18
modules/graphical/syncthing/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.syncthing.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.syncthing.enable {
|
||||
chvp.base.zfs.homeLinks = [
|
||||
{ path = ".config/syncthing"; type = "data"; }
|
||||
{ path = "sync"; type = "cache"; }
|
||||
];
|
||||
home-manager.users.charlotte = { pkgs, ... }: {
|
||||
services.syncthing.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
52
modules/graphical/terminal/default.nix
Normal file
52
modules/graphical/terminal/default.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.terminal.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.terminal.enable {
|
||||
home-manager.users.charlotte = { pkgs, ... }: {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
font_family = "Fira Code";
|
||||
font_size = 9;
|
||||
disable_ligatures = "cursor";
|
||||
background = "#ffffff";
|
||||
foreground = "#000000";
|
||||
cursor = "#777777";
|
||||
url_color = "#0031a9";
|
||||
# black
|
||||
color0 = "#282828";
|
||||
color8 = "#000000";
|
||||
# red
|
||||
color1 = "#a60000";
|
||||
color9 = "#972500";
|
||||
# green
|
||||
color2 = "#005e00";
|
||||
color10 = "#315b00";
|
||||
# yellow
|
||||
color3 = "#813e00";
|
||||
color11 = "#70480f";
|
||||
# blue
|
||||
color4 = "#0031a9";
|
||||
color12 = "#2544bb";
|
||||
# magenta
|
||||
color5 = "#721045";
|
||||
color13 = "#8f0075";
|
||||
# cyan
|
||||
color6 = "#00538b";
|
||||
color14 = "#30517f";
|
||||
# white
|
||||
color7 = "#f8f8f8";
|
||||
color15 = "#ffffff";
|
||||
enable_audio_bell = false;
|
||||
visual_bell_duration = "0.25";
|
||||
remember_window_size = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
77
modules/graphical/theme/default.nix
Normal file
77
modules/graphical/theme/default.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.theme.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.theme.enable {
|
||||
fonts = {
|
||||
fontDir.enable = true;
|
||||
fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
monospace = [ "Fira Code" ];
|
||||
sansSerif = [ "Noto Sans" ];
|
||||
serif = [ "Noto Serif" ];
|
||||
};
|
||||
};
|
||||
fonts = with pkgs; [
|
||||
fira-code
|
||||
fira-code-symbols
|
||||
font-awesome_4
|
||||
noto-fonts
|
||||
noto-fonts-cjk
|
||||
noto-fonts-emoji
|
||||
noto-fonts-extra
|
||||
];
|
||||
};
|
||||
|
||||
home-manager.users.charlotte = { pkgs, ... }: {
|
||||
home.packages = [ pkgs.vanilla-dmz ];
|
||||
home.file = {
|
||||
".icons/default/index.theme".text = ''
|
||||
[Icon Theme]
|
||||
Name=Default
|
||||
Comment=Default Cursor Theme
|
||||
Inherits=Vanilla-DMZ
|
||||
'';
|
||||
};
|
||||
dconf.settings."org/gnome/desktop/interface" = {
|
||||
gtk-theme = "Arc";
|
||||
icon-theme = "Arc";
|
||||
cursor-theme = "Vanilla-DMZ";
|
||||
};
|
||||
gtk = {
|
||||
enable = true;
|
||||
font = {
|
||||
package = pkgs.noto-fonts;
|
||||
name = "Noto Sans";
|
||||
size = 10;
|
||||
};
|
||||
gtk2.extraConfig = ''
|
||||
gtk-cursor-theme-name = "Vanilla-DMZ"
|
||||
gtk-cursor-theme-size = 0
|
||||
'';
|
||||
gtk3.extraConfig = {
|
||||
gtk-cursor-theme-name = "Vanilla-DMZ";
|
||||
gtk-cursor-theme-size = 0;
|
||||
};
|
||||
iconTheme = {
|
||||
package = pkgs.arc-icon-theme;
|
||||
name = "Arc";
|
||||
};
|
||||
theme = {
|
||||
package = pkgs.arc-theme;
|
||||
name = "Arc";
|
||||
};
|
||||
};
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme = "gtk";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
58
modules/graphical/xdg/default.nix
Normal file
58
modules/graphical/xdg/default.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
options.chvp.graphical.xdg.enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.graphical.xdg.enable {
|
||||
chvp.base.zfs.homeLinks = [
|
||||
{ path = "desktop"; type = "data"; }
|
||||
{ path = "documents"; type = "data"; }
|
||||
{ path = "downloads"; type = "cache"; }
|
||||
{ path = "music"; type = "data"; }
|
||||
{ path = "pictures"; type = "cache"; }
|
||||
{ path = "repos"; type = "cache"; }
|
||||
{ path = "templates"; type = "data"; }
|
||||
{ path = "videos"; type = "data"; }
|
||||
];
|
||||
|
||||
home-manager.users.charlotte = { pkgs, ... }: {
|
||||
home.packages = with pkgs; [ xdg-user-dirs ];
|
||||
xdg = {
|
||||
enable = true;
|
||||
# Some applications overwrite mimeapps.list with an identical file
|
||||
configFile."mimeapps.list".force = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"image/png" = [ "org.kde.okular.desktop" ];
|
||||
"image/jpg" = [ "org.kde.okular.desktop" ];
|
||||
"image/jpeg" = [ "org.kde.okular.desktop" ];
|
||||
"application/pdf" = [ "org.kde.okular.desktop" ];
|
||||
|
||||
"text/html" = [ "firefox.desktop" ];
|
||||
"x-scheme-handler/about" = [ "firefox.desktop" ];
|
||||
"x-scheme-handler/http" = [ "firefox.desktop" ];
|
||||
"x-scheme-handler/https" = [ "firefox.desktop" ];
|
||||
"x-scheme-handler/unknown" = [ "firefox.desktop" ];
|
||||
|
||||
"x-scheme-handler/msteams" = [ "teams.desktop" ];
|
||||
};
|
||||
};
|
||||
userDirs = {
|
||||
enable = true;
|
||||
desktop = "\$HOME/desktop";
|
||||
documents = "\$HOME/documents";
|
||||
download = "\$HOME/downloads";
|
||||
music = "\$HOME/music";
|
||||
pictures = "\$HOME/pictures";
|
||||
publicShare = "\$HOME/desktop";
|
||||
templates = "\$HOME/templates";
|
||||
videos = "\$HOME/videos";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue