more adjustments

This commit is contained in:
Noah Masur
2025-02-15 20:26:14 -05:00
parent 2425c76a84
commit 617fc6cce2
36 changed files with 288 additions and 291 deletions

View File

@ -199,20 +199,19 @@ in
exec = "${config.terminalLaunchCommand} aerc %u";
};
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+Shift+e" =
"exec ${
# Don't name the script `aerc` or it will affect grep
builtins.toString (
pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id ${config.terminal} start --class aerc -- aerc"
sleep 0.25
fi
i3-msg "[class=aerc] focus"
''
)
}";
"${config.xsession.windowManager.i3.config.modifier}+Shift+e" = "exec ${
# Don't name the script `aerc` or it will affect grep
builtins.toString (
pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id ${config.terminal} start --class aerc -- aerc"
sleep 0.25
fi
i3-msg "[class=aerc] focus"
''
)
}";
};
programs.fish.shellAbbrs = {

View File

@ -183,20 +183,19 @@ in
};
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+Shift+b" =
"exec ${
# Don't name the script `firefox` or it will affect grep
builtins.toString (
pkgs.writeShellScript "focus-ff.sh" ''
count=$(ps aux | grep -c firefox)
if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id firefox"
sleep 0.5
fi
i3-msg "[class=firefox] focus"
''
)
}";
"${config.xsession.windowManager.i3.config.modifier}+Shift+b" = "exec ${
# Don't name the script `firefox` or it will affect grep
builtins.toString (
pkgs.writeShellScript "focus-ff.sh" ''
count=$(ps aux | grep -c firefox)
if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id firefox"
sleep 0.5
fi
i3-msg "[class=firefox] focus"
''
)
}";
};
};
}

View File

@ -91,7 +91,6 @@ in
scs = "systemctl status";
sca = "systemctl cat";
m = "make";
t = "trash";
# Vim (overwritten by Neovim)
v = "vim";

View File

@ -25,7 +25,7 @@ let
-B -o ldif-wrap=no \
-E pr=5000/prompt \
-H "${ldap_scheme}://''${LDAP_HOST}:${builtins.toString ldap_port}" \
-D "${pkgs.lib.toUpper magic_prefix}2\\${pkgs.lib.toLower config.user}" \
-D "${pkgs.lib.toUpper magic_prefix}2\\${pkgs.lib.toLower config.home.username}" \
-w "$(${pkgs._1password-cli}/bin/op item get T2 --fields label=password --reveal)" \
-b "dc=''${LDAP_HOST//./,dc=}" \
-s "sub" -x "(cn=''${SEARCH_FILTER})" \

View File

@ -18,7 +18,7 @@ in
# Quick button for launching nautilus
xsession.windowManager.i3.config.keybindings = {
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+n" =
"${config.xsession.windowManager.i3.config.modifier}+n" =
"exec --no-startup-id ${pkgs.nautilus}/bin/nautilus";
};

View File

@ -6,6 +6,7 @@
}:
let
inherit (config.nmasur.settings) username;
cfg = config.nmasur.presets.programs.nixpkgs;
in
@ -124,7 +125,7 @@ in
# For security, only allow specific users
settings.allowed-users = [
"@wheel" # Anyone in the wheel group
config.user # The current user
config.home.username # The current user
];
# Enable features in Nix commands

View File

@ -0,0 +1,27 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.nmasur.presets.programs.obsidian;
in
{
options = {
nmasur.presets.programs.obsidian = {
enable = lib.mkEnableOption "Obsidian markdown wiki";
};
};
config = lib.mkIf cfg.enable {
unfreePackages = [ "obsidian" ];
home.packages = with pkgs; [ obsidian ];
# Broken on 2023-12-11
# https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8
# insecurePackages = [ "electron-25.9.0" ];
};
}

View File

@ -8,7 +8,7 @@
options.tmux.enable = lib.mkEnableOption "Tmux terminal multiplexer";
config.home-manager.users.${config.user} = lib.mkIf config.tmux.enable {
config = lib.mkIf config.tmux.enable {
programs.tmux = {
enable = true;

View File

@ -28,13 +28,11 @@ in
};
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./Spoons/MoveWindow.spoon;
home.activation.reloadHammerspoon =
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ]
''
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
$DRY_RUN_CMD sleep 1
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
'';
home.activation.reloadHammerspoon = config.lib.dag.entryAfter [ "writeBoundary" ] ''
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
$DRY_RUN_CMD sleep 1
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
'';
};
}

View File

@ -4,119 +4,120 @@
lib,
...
}:
let
inherit (config.nmasur.settings) fullName;
cfg = config.nmasur.presets.services.mbsync;
in
{
options = {
mail.enable = lib.mkEnableOption "Mail service.";
mail.user = lib.mkOption {
options.nmasur.preset.services.mbsync = {
enable = lib.mkEnableOption "Mail service.";
user = lib.mkOption {
type = lib.types.str;
description = "User name for the email address.";
default = config.user;
};
mail.server = lib.mkOption {
type = lib.types.nullOr lib.types.str;
server = lib.mkOption {
type = lib.types.str;
description = "Server name for the email address.";
};
mail.imapHost = lib.mkOption {
type = lib.types.nullOr lib.types.str;
imapHost = lib.mkOption {
type = lib.types.str;
description = "Server host for IMAP (reading mail).";
};
mail.smtpHost = lib.mkOption {
type = lib.types.nullOr lib.types.str;
smtpHost = lib.mkOption {
type = lib.types.str;
description = "Server host for SMTP (sending mail).";
};
};
config = lib.mkIf config.mail.enable {
config = lib.mkIf cfg.enable {
home-manager.users.${config.user} = {
programs.mbsync = {
enable = true;
};
programs.mbsync = {
enable = true;
};
# Automatically check for mail and keep files synced locally
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
frequency = "*:0/5";
postExec = "${lib.getExe pkgs.notmuch} new";
};
# Automatically check for mail and keep files synced locally
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
frequency = "*:0/5";
postExec = "${lib.getExe pkgs.notmuch} new";
};
# Used to watch for new mail and trigger sync
services.imapnotify.enable = pkgs.stdenv.isLinux;
# Used to watch for new mail and trigger sync
services.imapnotify.enable = pkgs.stdenv.isLinux;
# Allows sending email from CLI/sendmail
programs.msmtp.enable = true;
# Allows sending email from CLI/sendmail
programs.msmtp.enable = true;
accounts.email = {
accounts.email = {
# Where email files are stored
maildirBasePath = "${config.home.homeDirectory}/mail";
# Where email files are stored
maildirBasePath = "${config.home.homeDirectory}/mail";
accounts = {
home =
let
address = "${config.mail.user}@${config.mail.server}";
in
{
userName = address;
realName = config.fullName;
primary = true;
inherit address;
aliases = map (user: "${user}@${config.mail.server}") [
"me"
"hey"
"admin"
];
accounts = {
home =
let
address = "${cfg.user}@${cfg.server}";
in
{
userName = address;
realName = fullName;
primary = true;
inherit address;
aliases = map (user: "${user}@${cfg.server}") [
"me"
"hey"
"admin"
];
# Options for contact completion
alot = { };
# Options for contact completion
alot = { };
imap = {
host = config.mail.imapHost;
port = 993;
tls.enable = true;
};
imap = {
host = cfg.imapHost;
port = 993;
tls.enable = true;
};
# Watch for mail and run notifications or sync
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost =
lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable
"${lib.getExe pkgs.libnotify} 'New mail arrived'";
};
# Watch for mail and run notifications or sync
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost = lib.mkIf config.services.dunst.enable "${lib.getExe pkgs.libnotify} 'New mail arrived'";
};
# Name of the directory in maildir for this account
maildir = {
path = "main";
};
# Name of the directory in maildir for this account
maildir = {
path = "main";
};
# Bi-directional syncing options for local files
mbsync = {
enable = true;
create = "both";
expunge = "both";
remove = "both";
patterns = [ "*" ];
extraConfig.channel = {
CopyArrivalDate = "yes"; # Sync time of original message
};
};
# Enable indexing
notmuch.enable = true;
# Used to login and send and receive emails
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
smtp = {
host = config.mail.smtpHost;
port = 465;
tls.enable = true;
# Bi-directional syncing options for local files
mbsync = {
enable = true;
create = "both";
expunge = "both";
remove = "both";
patterns = [ "*" ];
extraConfig.channel = {
CopyArrivalDate = "yes"; # Sync time of original message
};
};
};
# Enable indexing
notmuch.enable = true;
# Used to login and send and receive emails
passwordCommand = "${lib.getExe pkgs.age} --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
smtp = {
host = cfg.smtpHost;
port = 465;
tls.enable = true;
};
};
};
};
};

View File

@ -35,9 +35,14 @@ in
};
};
programs.fish.shellAliases = {
# Move files to XDG trash on the commandline
trash = lib.mkDefault "${pkgs.trash-cli}/bin/trash-put";
programs.fish = {
shellAliases = {
# Move files to XDG trash on the commandline
trash = lib.mkDefault "${pkgs.trash-cli}/bin/trash-put";
};
shellAbbrs = {
t = "trash";
};
};
};
}

View File

@ -21,8 +21,8 @@ in
pkgs.jo # JSON output
pkgs.osc # Clipboard over SSH
pkgs.qrencode # Generate qr codes
# pkgs.ren # Rename files
# pkgs.rep # Replace text in files
pkgs.ren # Rename files
pkgs.rep # Replace text in files
pkgs.spacer # Output lines in terminal
pkgs.tealdeer # Cheatsheets
pkgs.vimv-rs # Batch rename files

View File

@ -58,6 +58,7 @@ in
k9s.enable = lib.mkDefault true;
kubectl.enable = lib.mkDefault true;
ldapsearch.enable = lib.mkDefault true;
obsidian.enable = lib.mkDefault true;
ripgrep.enable = lib.mkDefault true;
starship.enable = lib.mkDefault true;
terraform.enable = lib.mkDefault true;