mirror of
https://github.com/nmasur/dotfiles
synced 2025-01-28 21:12:02 +00:00
initial refactoring
This commit is contained in:
parent
a4b5e05f8f
commit
4aa9f5a464
@ -1,41 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
_1password = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable 1Password.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config._1password.enable) {
|
||||
unfreePackages = [
|
||||
"1password"
|
||||
"_1password-gui"
|
||||
"1password-cli"
|
||||
];
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs._1password-cli
|
||||
] ++ (if pkgs.stdenv.isLinux then [ pkgs._1password-gui ] else [ ]);
|
||||
};
|
||||
|
||||
# https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app
|
||||
# On Mac, does not apply: https://1password.community/discussion/142794/app-and-browser-integration
|
||||
# However, the button doesn't work either:
|
||||
# https://1password.community/discussion/140735/extending-support-for-trusted-web-browsers
|
||||
environment.etc."1password/custom_allowed_browsers".text = ''
|
||||
${
|
||||
config.home-manager.users.${config.user}.programs.firefox.package
|
||||
}/Applications/Firefox.app/Contents/MacOS/firefox
|
||||
firefox
|
||||
'';
|
||||
};
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
alacritty = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Alacritty.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.alacritty.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
xsession.windowManager.i3.config.terminal = "alacritty";
|
||||
programs.rofi.terminal = "${pkgs.alacritty}/bin/alacritty";
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
window = {
|
||||
dimensions = {
|
||||
columns = 85;
|
||||
lines = 30;
|
||||
};
|
||||
padding = {
|
||||
x = 20;
|
||||
y = 20;
|
||||
};
|
||||
opacity = 1.0;
|
||||
};
|
||||
scrolling.history = 10000;
|
||||
font = {
|
||||
size = 14.0;
|
||||
};
|
||||
key_bindings = [
|
||||
# Used for word completion in fish_user_key_bindings
|
||||
{
|
||||
key = "Return";
|
||||
mods = "Shift";
|
||||
chars = "\\x1F";
|
||||
}
|
||||
# Used for searching nixpkgs in fish_user_key_bindings
|
||||
{
|
||||
key = "N";
|
||||
mods = "Control|Shift";
|
||||
chars = "\\x11F";
|
||||
}
|
||||
{
|
||||
key = "H";
|
||||
mods = "Control|Shift";
|
||||
mode = "~Vi";
|
||||
action = "ToggleViMode";
|
||||
}
|
||||
{
|
||||
key = "Return";
|
||||
mode = "Vi";
|
||||
action = "ToggleViMode";
|
||||
}
|
||||
# Used to enable $ keybind in Vi mode
|
||||
{
|
||||
key = 5; # Scancode for key4
|
||||
mods = "Shift";
|
||||
mode = "Vi|~Search";
|
||||
action = "Last";
|
||||
}
|
||||
];
|
||||
colors = {
|
||||
primary = {
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
};
|
||||
cursor = {
|
||||
text = "#1d2021";
|
||||
cursor = config.theme.colors.base05;
|
||||
};
|
||||
normal = {
|
||||
black = "#1d2021";
|
||||
red = config.theme.colors.base08;
|
||||
green = config.theme.colors.base0B;
|
||||
yellow = config.theme.colors.base0A;
|
||||
blue = config.theme.colors.base0D;
|
||||
magenta = config.theme.colors.base0E;
|
||||
cyan = config.theme.colors.base0C;
|
||||
white = config.theme.colors.base05;
|
||||
};
|
||||
bright = {
|
||||
black = config.theme.colors.base03;
|
||||
red = config.theme.colors.base09;
|
||||
green = config.theme.colors.base01;
|
||||
yellow = config.theme.colors.base02;
|
||||
blue = config.theme.colors.base04;
|
||||
magenta = config.theme.colors.base06;
|
||||
cyan = config.theme.colors.base0F;
|
||||
white = config.theme.colors.base07;
|
||||
};
|
||||
};
|
||||
draw_bold_text_with_bright_colors = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
discord = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Discord.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.discord.enable) {
|
||||
unfreePackages = [ "discord" ];
|
||||
environment.systemPackages = [ pkgs.discord ];
|
||||
home-manager.users.${config.user} = {
|
||||
xdg.configFile."discord/settings.json".text = ''
|
||||
{
|
||||
"BACKGROUND_COLOR": "#202225",
|
||||
"IS_MAXIMIZED": false,
|
||||
"IS_MINIMIZED": false,
|
||||
"OPEN_ON_STARTUP": false,
|
||||
"MINIMIZE_TO_TRAY": false,
|
||||
"SKIP_HOST_UPDATE": true
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -1,203 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
|
||||
options = {
|
||||
firefox = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Firefox.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.firefox.enable) {
|
||||
|
||||
unfreePackages = [
|
||||
(lib.mkIf config._1password.enable "onepassword-password-manager")
|
||||
"okta-browser-plugin"
|
||||
];
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package = if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
|
||||
profiles.default = {
|
||||
id = 0;
|
||||
name = "default";
|
||||
isDefault = true;
|
||||
# https://nur.nix-community.org/repos/rycee/
|
||||
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
||||
(lib.mkIf config._1password.enable onepassword-password-manager)
|
||||
darkreader
|
||||
don-t-fuck-with-paste
|
||||
facebook-container
|
||||
markdownload
|
||||
multi-account-containers
|
||||
okta-browser-plugin
|
||||
reddit-enhancement-suite
|
||||
return-youtube-dislikes
|
||||
sponsorblock
|
||||
ublock-origin
|
||||
ublacklist
|
||||
vimium
|
||||
];
|
||||
settings = {
|
||||
"app.update.auto" = false;
|
||||
"browser.aboutConfig.showWarning" = false;
|
||||
"browser.warnOnQuit" = false;
|
||||
"browser.quitShortcut.disabled" = if pkgs.stdenv.isLinux then true else false;
|
||||
"browser.theme.dark-private-windows" = true;
|
||||
"browser.toolbars.bookmarks.visibility" = false;
|
||||
"browser.startup.page" = 3; # Restore previous session
|
||||
"browser.newtabpage.enabled" = false; # Make new tabs blank
|
||||
"trailhead.firstrun.didSeeAboutWelcome" = true; # Disable welcome splash
|
||||
"dom.forms.autocomplete.formautofill" = false; # Disable autofill
|
||||
"extensions.formautofill.creditCards.enabled" = false; # Disable credit cards
|
||||
"dom.payments.defaults.saveAddress" = false; # Disable address save
|
||||
"general.autoScroll" = true; # Drag middle-mouse to scroll
|
||||
"services.sync.prefs.sync.general.autoScroll" = false; # Prevent disabling autoscroll
|
||||
"extensions.pocket.enabled" = false;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
|
||||
"layout.css.color-mix.enabled" = true;
|
||||
"ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
|
||||
"media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
|
||||
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
|
||||
"devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page
|
||||
"svg.context-properties.content.enabled" = true; # Sidebery styling
|
||||
"browser.tabs.hoverPreview.enabled" = false; # Disable tab previews
|
||||
"browser.tabs.hoverPreview.showThumbnails" = false; # Disable tab previews
|
||||
};
|
||||
userChrome = ''
|
||||
:root {
|
||||
--focus-outline-color: ${config.theme.colors.base04} !important;
|
||||
--toolbar-color: ${config.theme.colors.base07} !important;
|
||||
--tab-min-height: 30px !important;
|
||||
}
|
||||
/* Background of tab bar */
|
||||
.toolbar-items {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
}
|
||||
/* Extra tab bar sides on macOS */
|
||||
.titlebar-spacer {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
}
|
||||
.titlebar-buttonbox-container {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
}
|
||||
#tabbrowser-tabs {
|
||||
border-inline-start: 0 !important;
|
||||
}
|
||||
/* Private Browsing indicator on macOS */
|
||||
#private-browsing-indicator-with-label {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
margin-inline: 0 !important;
|
||||
padding-inline: 7px;
|
||||
}
|
||||
/* Tabs themselves */
|
||||
.tabbrowser-tab .tab-stack {
|
||||
border-radius: 5px 5px 0 0;
|
||||
overflow: hidden;
|
||||
background-color: ${config.theme.colors.base00};
|
||||
color: ${config.theme.colors.base06} !important;
|
||||
}
|
||||
.tab-content {
|
||||
border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 40%, transparent);
|
||||
border-radius: 5px 5px 0 0;
|
||||
background-color: ${config.theme.colors.base00};
|
||||
color: ${config.theme.colors.base06} !important;
|
||||
}
|
||||
.tab-content[selected] {
|
||||
border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent);
|
||||
background-color: ${config.theme.colors.base01} !important;
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
}
|
||||
/* Below tab bar */
|
||||
#nav-bar {
|
||||
background: ${config.theme.colors.base01} !important;
|
||||
}
|
||||
/* URL bar in nav bar */
|
||||
#urlbar[focused=true] {
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
background: ${config.theme.colors.base02} !important;
|
||||
caret-color: ${config.theme.colors.base05} !important;
|
||||
}
|
||||
#urlbar:not([focused=true]) {
|
||||
color: ${config.theme.colors.base04} !important;
|
||||
background: ${config.theme.colors.base02} !important;
|
||||
}
|
||||
#urlbar ::-moz-selection {
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
background: ${config.theme.colors.base02} !important;
|
||||
}
|
||||
#urlbar-input-container {
|
||||
border: 1px solid ${config.theme.colors.base01} !important;
|
||||
}
|
||||
#urlbar-background {
|
||||
background: ${config.theme.colors.base01} !important;
|
||||
}
|
||||
/* Text in URL bar */
|
||||
#urlbar-input, #urlbar-scheme, .searchbar-textbox {
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
}
|
||||
'';
|
||||
userContent = ''
|
||||
@-moz-document url-prefix(about:blank) {
|
||||
* {
|
||||
background-color:${config.theme.colors.base01} !important;
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
extraConfig = "";
|
||||
};
|
||||
};
|
||||
|
||||
# Mimic nixpkgs package environment for read-only profiles.ini management
|
||||
# From: https://github.com/booxter/home-manager/commit/dd1602e306fec366280f5953c5e1b553e3d9672a
|
||||
home.sessionVariables = {
|
||||
MOZ_LEGACY_PROFILES = 1;
|
||||
MOZ_ALLOW_DOWNGRADE = 1;
|
||||
};
|
||||
|
||||
# launchd.user.envVariables = config.home-manager.users.${config.user}.home.sessionVariables;
|
||||
|
||||
xdg.mimeApps = {
|
||||
associations.added = {
|
||||
"text/html" = [ "firefox.desktop" ];
|
||||
};
|
||||
defaultApplications = {
|
||||
"text/html" = [ "firefox.desktop" ];
|
||||
};
|
||||
associations.removed = {
|
||||
"text/html" = [ "wine-extension-htm.desktop" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
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"
|
||||
''
|
||||
)
|
||||
}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
kitty = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Kitty.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
||||
|
||||
# Set the Rofi-Systemd terminal for viewing logs
|
||||
# Using optionalAttrs because only available in NixOS
|
||||
environment =
|
||||
{ }
|
||||
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
|
||||
sessionVariables.ROFI_SYSTEMD_TERM = lib.mkDefault "${pkgs.kitty}/bin/kitty";
|
||||
};
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
# Set the i3 terminal
|
||||
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
|
||||
|
||||
# Set the Rofi terminal for running programs
|
||||
programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "${pkgs.kitty}/bin/kitty");
|
||||
|
||||
# Display images in the terminal
|
||||
programs.fish.interactiveShellInit = # fish
|
||||
''
|
||||
if test "$TERM" = "xterm-kitty"
|
||||
alias icat="kitty +kitten icat"
|
||||
alias ssh="kitty +kitten ssh"
|
||||
end
|
||||
'';
|
||||
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
environment = { };
|
||||
extraConfig = "";
|
||||
font.size = 14;
|
||||
keybindings = {
|
||||
# Use shift+enter to complete text suggestions in fish
|
||||
"shift+enter" = "send_text all \\x1F";
|
||||
|
||||
# Easy fullscreen toggle (for macOS)
|
||||
"super+f" = "toggle_fullscreen";
|
||||
};
|
||||
settings = {
|
||||
|
||||
# Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache)
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
selection_background = config.theme.colors.base05;
|
||||
selection_foreground = config.theme.colors.base00;
|
||||
url_color = config.theme.colors.base04;
|
||||
cursor = config.theme.colors.base05;
|
||||
active_border_color = config.theme.colors.base03;
|
||||
inactive_border_color = config.theme.colors.base01;
|
||||
active_tab_background = config.theme.colors.base00;
|
||||
active_tab_foreground = config.theme.colors.base05;
|
||||
inactive_tab_background = config.theme.colors.base01;
|
||||
inactive_tab_foreground = config.theme.colors.base04;
|
||||
tab_bar_background = config.theme.colors.base01;
|
||||
|
||||
# normal
|
||||
color0 = config.theme.colors.base00;
|
||||
color1 = config.theme.colors.base08;
|
||||
color2 = config.theme.colors.base0B;
|
||||
color3 = config.theme.colors.base0A;
|
||||
color4 = config.theme.colors.base0D;
|
||||
color5 = config.theme.colors.base0E;
|
||||
color6 = config.theme.colors.base0C;
|
||||
color7 = config.theme.colors.base05;
|
||||
|
||||
# bright
|
||||
color8 = config.theme.colors.base03;
|
||||
color9 = config.theme.colors.base08;
|
||||
color10 = config.theme.colors.base0B;
|
||||
color11 = config.theme.colors.base0A;
|
||||
color12 = config.theme.colors.base0D;
|
||||
color13 = config.theme.colors.base0E;
|
||||
color14 = config.theme.colors.base0C;
|
||||
color15 = config.theme.colors.base07;
|
||||
|
||||
# extended base16 colors
|
||||
color16 = config.theme.colors.base09;
|
||||
color17 = config.theme.colors.base0F;
|
||||
color18 = config.theme.colors.base01;
|
||||
color19 = config.theme.colors.base02;
|
||||
color20 = config.theme.colors.base04;
|
||||
color21 = config.theme.colors.base06;
|
||||
|
||||
# Scrollback
|
||||
scrollback_lines = 10000;
|
||||
scrollback_pager_history_size = 300; # MB
|
||||
|
||||
# Window
|
||||
window_padding_width = 6;
|
||||
|
||||
tab_bar_edge = "top";
|
||||
tab_bar_style = "slant";
|
||||
|
||||
# Disable audio
|
||||
enable_audio_bell = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
media = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable media programs.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.media.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = with pkgs; [
|
||||
nsxiv # Image viewer
|
||||
mupdf # PDF viewer
|
||||
zathura # PDF viewer
|
||||
];
|
||||
|
||||
# Video player
|
||||
programs.mpv = {
|
||||
enable = true;
|
||||
bindings = { };
|
||||
config = {
|
||||
image-display-duration = 2; # For cycling through images
|
||||
hwdec = "auto-safe"; # Attempt to use GPU decoding for video
|
||||
};
|
||||
scripts = [
|
||||
|
||||
# Automatically load playlist entries before and after current file
|
||||
pkgs.mpvScripts.autoload
|
||||
|
||||
# Delete current file after quitting
|
||||
pkgs.mpvScripts.mpv-delete-file
|
||||
];
|
||||
};
|
||||
|
||||
# Set default programs for opening PDFs and other media
|
||||
xdg.mimeApps = {
|
||||
associations.added = {
|
||||
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||
"image/jpeg" = [ "nsxiv.desktop" ];
|
||||
"image/png" = [ "nsxiv.desktop" ];
|
||||
"image/*" = [ "nsxiv.desktop" ];
|
||||
};
|
||||
associations.removed = {
|
||||
"application/pdf" = [
|
||||
"mupdf.desktop"
|
||||
"wine-extension-pdf.desktop"
|
||||
];
|
||||
};
|
||||
defaultApplications = {
|
||||
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||
"image/jpeg" = [ "nsxiv.desktop" ];
|
||||
"image/png" = [ "nsxiv.desktop" ];
|
||||
"image/*" = [ "nsxiv.desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
obsidian = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Obsidian.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.obsidian.enable) {
|
||||
unfreePackages = [ "obsidian" ];
|
||||
home-manager.users.${config.user} = {
|
||||
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" ];
|
||||
};
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
qbittorrent = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable qBittorrent.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.qbittorrent.enable) {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home.packages = with pkgs; [ qbittorrent ];
|
||||
};
|
||||
};
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
slack = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Slack.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.slack.enable) {
|
||||
unfreePackages = [ "slack" ];
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = with pkgs; [ slack ];
|
||||
};
|
||||
};
|
||||
|
||||
# Theme string: #1D2122,#665C54,#8EC07C,#BDAE93
|
||||
}
|
@ -1,286 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
wezterm = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable WezTerm terminal.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
font = config.home-manager.users.${config.user}.programs.kitty.font.name;
|
||||
in
|
||||
lib.mkIf (config.gui.enable && config.wezterm.enable) {
|
||||
|
||||
# Set the Rofi-Systemd terminal for viewing logs
|
||||
# Using optionalAttrs because only available in NixOS
|
||||
environment =
|
||||
{ }
|
||||
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
|
||||
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.wezterm}/bin/wezterm";
|
||||
};
|
||||
|
||||
terminal = "${pkgs.wezterm}/bin/wezterm";
|
||||
terminalLaunchCommand = "${config.terminal} start --";
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
# Set the i3 terminal
|
||||
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "wezterm";
|
||||
|
||||
# Display images in the terminal
|
||||
programs.fish.shellAliases = {
|
||||
icat = lib.mkForce "wezterm imgcat";
|
||||
};
|
||||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
colorSchemes = {
|
||||
myTheme = {
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
cursor_bg = config.theme.colors.base05;
|
||||
cursor_fg = config.theme.colors.base00;
|
||||
cursor_border = config.theme.colors.base05;
|
||||
selection_bg = config.theme.colors.base05;
|
||||
selection_fg = config.theme.colors.base00;
|
||||
scrollbar_thumb = config.theme.colors.base03;
|
||||
ansi = [
|
||||
config.theme.colors.base01 # black
|
||||
config.theme.colors.base0F # maroon
|
||||
config.theme.colors.base0B # green
|
||||
config.theme.colors.base0A # olive
|
||||
config.theme.colors.base0D # navy
|
||||
config.theme.colors.base0E # purple
|
||||
config.theme.colors.base0C # teal
|
||||
config.theme.colors.base06 # silver
|
||||
];
|
||||
brights = [
|
||||
config.theme.colors.base03 # grey
|
||||
config.theme.colors.base08 # red
|
||||
config.theme.colors.base0B # lime
|
||||
config.theme.colors.base0A # yellow
|
||||
config.theme.colors.base0D # blue
|
||||
config.theme.colors.base0E # fuchsia
|
||||
config.theme.colors.base0C # aqua
|
||||
config.theme.colors.base07 # white
|
||||
];
|
||||
compose_cursor = config.theme.colors.base09; # orange
|
||||
copy_mode_active_highlight_bg = {
|
||||
Color = config.theme.colors.base03;
|
||||
};
|
||||
copy_mode_active_highlight_fg = {
|
||||
Color = config.theme.colors.base07;
|
||||
};
|
||||
copy_mode_inactive_highlight_bg = {
|
||||
Color = config.theme.colors.base02;
|
||||
};
|
||||
copy_mode_inactive_highlight_fg = {
|
||||
Color = config.theme.colors.base06;
|
||||
};
|
||||
quick_select_label_bg = {
|
||||
Color = config.theme.colors.base02;
|
||||
};
|
||||
quick_select_label_fg = {
|
||||
Color = config.theme.colors.base06;
|
||||
};
|
||||
quick_select_match_bg = {
|
||||
Color = config.theme.colors.base03;
|
||||
};
|
||||
quick_select_match_fg = {
|
||||
Color = config.theme.colors.base07;
|
||||
};
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
local wezterm = require("wezterm")
|
||||
local config = wezterm.config_builder()
|
||||
config.check_for_updates = false
|
||||
config.color_scheme = "myTheme"
|
||||
|
||||
-- Scrollback
|
||||
config.scrollback_lines = 10000
|
||||
|
||||
-- Window
|
||||
config.window_padding = {
|
||||
left = 10,
|
||||
right = 10,
|
||||
top = 10,
|
||||
bottom = 12,
|
||||
}
|
||||
|
||||
config.font = wezterm.font('${font}', { weight = 'Bold'})
|
||||
config.font_size = ${if pkgs.stdenv.isLinux then "14.0" else "18.0"}
|
||||
|
||||
-- Fix color blocks instead of text
|
||||
config.front_end = "WebGpu"
|
||||
|
||||
-- Tab Bar
|
||||
config.hide_tab_bar_if_only_one_tab = true
|
||||
config.window_frame = {
|
||||
font = wezterm.font('${font}', { weight = 'Bold'}),
|
||||
font_size = ${if pkgs.stdenv.isLinux then "12.0" else "16.0"},
|
||||
}
|
||||
|
||||
config.colors = {
|
||||
tab_bar = {
|
||||
active_tab = {
|
||||
bg_color = '${config.theme.colors.base00}',
|
||||
fg_color = '${config.theme.colors.base04}',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Disable audio
|
||||
config.audible_bell = "Disabled"
|
||||
|
||||
config.initial_rows = 80
|
||||
config.initial_cols = 200
|
||||
|
||||
config.unix_domains = {
|
||||
{
|
||||
name = 'unix',
|
||||
},
|
||||
}
|
||||
|
||||
-- This causes `wezterm` to act as though it was started as
|
||||
-- `wezterm connect unix` by default, connecting to the unix
|
||||
-- domain on startup.
|
||||
-- If you prefer to connect manually, leave out this line.
|
||||
config.default_gui_startup_args = { 'connect', 'unix' }
|
||||
|
||||
config.leader = {
|
||||
key = 'a',
|
||||
mods = 'CTRL',
|
||||
timeout_milliseconds = 2000,
|
||||
}
|
||||
|
||||
config.keys = {
|
||||
-- Attach to muxer
|
||||
{
|
||||
key = 'a',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.AttachDomain 'unix',
|
||||
},
|
||||
|
||||
-- Detach from muxer
|
||||
{
|
||||
key = 'd',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.DetachDomain { DomainName = 'unix' },
|
||||
},
|
||||
-- sends completion string for fish autosuggestions
|
||||
{
|
||||
key = 'Enter',
|
||||
mods = 'SHIFT',
|
||||
action = wezterm.action.SendString '\x1F'
|
||||
},
|
||||
-- ctrl-shift-h was "hide"
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'SHIFT|CTRL',
|
||||
action = wezterm.action.DisableDefaultAssignment
|
||||
},
|
||||
-- alt-enter was "fullscreen"
|
||||
{
|
||||
key = 'Enter',
|
||||
mods = 'ALT',
|
||||
action = wezterm.action.DisableDefaultAssignment
|
||||
},
|
||||
-- make super-f "fullscreen"
|
||||
{
|
||||
key = 'f',
|
||||
mods = 'SUPER',
|
||||
action = wezterm.action.ToggleFullScreen
|
||||
},
|
||||
-- super-t open new tab in new dir
|
||||
{
|
||||
key = 't',
|
||||
mods = ${if pkgs.stdenv.isDarwin then "'SUPER'" else "'ALT'"},
|
||||
action = wezterm.action.SpawnCommandInNewTab {
|
||||
cwd = wezterm.home_dir,
|
||||
},
|
||||
},
|
||||
-- shift-super-t open new tab in same dir
|
||||
{
|
||||
key = 't',
|
||||
mods = 'SUPER|SHIFT',
|
||||
action = wezterm.action.SpawnTab 'CurrentPaneDomain'
|
||||
},
|
||||
-- project switcher
|
||||
{
|
||||
key = 'P',
|
||||
mods = 'SUPER',
|
||||
action = wezterm.action_callback(function(window, pane)
|
||||
local choices = {}
|
||||
|
||||
wezterm.log_info "working?"
|
||||
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
local pfile = popen('${pkgs.fd}/bin/fd --search-path "'..directory..'" --type directory --exact-depth 2 | ${pkgs.proximity-sort}/bin/proximity-sort "'..os.getenv("HOME").."/dev/work"..'"')
|
||||
for filename in pfile:lines() do
|
||||
i = i + 1
|
||||
t[i] = filename
|
||||
end
|
||||
pfile:close()
|
||||
return t
|
||||
end
|
||||
|
||||
for _, v in pairs(scandir(os.getenv("HOME").."/dev")) do
|
||||
table.insert(choices, { label = v })
|
||||
end
|
||||
|
||||
window:perform_action(
|
||||
wezterm.action.InputSelector {
|
||||
action = wezterm.action_callback(function(window, pane, id, label)
|
||||
if not id and not label then
|
||||
wezterm.log_info "cancelled"
|
||||
else
|
||||
window:perform_action(
|
||||
wezterm.action.SpawnCommandInNewTab {
|
||||
cwd = label,
|
||||
},
|
||||
pane
|
||||
)
|
||||
end
|
||||
end),
|
||||
fuzzy = true,
|
||||
title = "Select Project",
|
||||
choices = choices,
|
||||
},
|
||||
pane
|
||||
)
|
||||
end),
|
||||
},
|
||||
}
|
||||
|
||||
-- print the workspace name at the upper right
|
||||
wezterm.on("update-right-status", function(window, pane)
|
||||
window:set_right_status(window:active_workspace())
|
||||
end)
|
||||
-- load plugin
|
||||
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
|
||||
-- set path to zoxide
|
||||
workspace_switcher.zoxide_path = "${pkgs.zoxide}/bin/zoxide"
|
||||
-- keymaps
|
||||
table.insert(config.keys, { key = "s", mods = "CTRL|SHIFT", action = workspace_switcher.switch_workspace() })
|
||||
-- table.insert(config.keys, { key = "t", mods = "CTRL|SHIFT", action = wezterm.action.ShowLauncherArgs({ flags = "FUZZY|WORKSPACES" }) })
|
||||
table.insert(config.keys, { key = "[", mods = "CTRL|SHIFT", action = wezterm.action.SwitchWorkspaceRelative(1) })
|
||||
table.insert(config.keys, { key = "]", mods = "CTRL|SHIFT", action = wezterm.action.SwitchWorkspaceRelative(-1) })
|
||||
|
||||
return config
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
yt-dlp = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable YouTube downloader.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.yt-dlp.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
programs.yt-dlp = {
|
||||
enable = true;
|
||||
extraConfig = "";
|
||||
settings = {
|
||||
no-continue = true; # Always re-download each fragment
|
||||
no-overwrites = true; # Don't overwrite existing files
|
||||
download-archive = "archive.log"; # Log of archives
|
||||
embed-metadata = true;
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "en.*";
|
||||
concurrent-fragments = 4; # Parallel download chunks
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs.yt = "yt-dlp";
|
||||
};
|
||||
};
|
||||
}
|
@ -1,220 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
|
||||
|
||||
config = lib.mkIf config.mail.aerc.enable {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
w3m # Render HTML
|
||||
dante # Socksify for rendering HTML
|
||||
];
|
||||
|
||||
programs.aerc = {
|
||||
enable = true;
|
||||
extraBinds = {
|
||||
# Binds are of the form <key sequence> = <command to run>
|
||||
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
|
||||
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
|
||||
global = {
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab <Enter>";
|
||||
"<C-t>" = ":term<Enter>";
|
||||
"?" = ":help keys<Enter>";
|
||||
};
|
||||
|
||||
messages = {
|
||||
q = ":quit<Enter>";
|
||||
|
||||
j = ":next <Enter>";
|
||||
"<Down>" = ":next<Enter>";
|
||||
"<C-d>" = ":next 50%<Enter>";
|
||||
"<C-f>" = ":next 100%<Enter>";
|
||||
"<PgDn>" = ":next 100%<Enter>";
|
||||
|
||||
k = ":prev <Enter>";
|
||||
"<Up>" = ":prev<Enter>";
|
||||
"<C-u>" = ":prev 50%<Enter>";
|
||||
"<C-b>" = ":prev 100%<Enter>";
|
||||
"<PgUp>" = ":prev 100%<Enter>";
|
||||
g = ":select 0 <Enter>";
|
||||
G = ":select -1<Enter>";
|
||||
|
||||
J = ":next-folder <Enter>";
|
||||
K = ":prev-folder<Enter>";
|
||||
H = ":collapse-folder<Enter>";
|
||||
L = ":expand-folder<Enter>";
|
||||
|
||||
v = ":mark -t<Enter>";
|
||||
V = ":mark -v<Enter>";
|
||||
|
||||
T = ":toggle-threads<Enter>";
|
||||
|
||||
"<Enter>" = ":view<Enter>";
|
||||
d = ":prompt 'Really delete this message?' 'delete-message'<Enter>";
|
||||
D = ":move Trash<Enter>";
|
||||
A = ":archive flat<Enter>";
|
||||
|
||||
C = ":compose<Enter>";
|
||||
|
||||
rr = ":reply -a<Enter>";
|
||||
rq = ":reply -aq<Enter>";
|
||||
Rr = ":reply<Enter>";
|
||||
Rq = ":reply -q<Enter>";
|
||||
|
||||
c = ":cf<space>";
|
||||
"$" = ":term<space>";
|
||||
"!" = ":term<space>";
|
||||
"|" = ":pipe<space>";
|
||||
|
||||
"/" = ":search<space>-a<space>";
|
||||
"\\" = ":filter <space>";
|
||||
n = ":next-result<Enter>";
|
||||
N = ":prev-result<Enter>";
|
||||
"<Esc>" = ":clear<Enter>";
|
||||
};
|
||||
|
||||
"messages:folder=Drafts" = {
|
||||
"<Enter>" = ":recall<Enter>";
|
||||
};
|
||||
|
||||
view = {
|
||||
"/" = ":toggle-key-passthrough <Enter> /";
|
||||
q = ":close<Enter>";
|
||||
O = ":open<Enter>";
|
||||
S = ":save<space>";
|
||||
"|" = ":pipe<space>";
|
||||
D = ":move Trash<Enter>";
|
||||
A = ":archive flat<Enter>";
|
||||
|
||||
"<C-l>" = ":open-link <space>";
|
||||
|
||||
f = ":forward <Enter>";
|
||||
rr = ":reply -a<Enter>";
|
||||
rq = ":reply -aq<Enter>";
|
||||
Rr = ":reply<Enter>";
|
||||
Rq = ":reply -q<Enter>";
|
||||
|
||||
H = ":toggle-headers<Enter>";
|
||||
"<C-k>" = ":prev-part<Enter>";
|
||||
"<C-j>" = ":next-part<Enter>";
|
||||
J = ":next <Enter>";
|
||||
K = ":prev<Enter>";
|
||||
};
|
||||
|
||||
"view::passthrough" = {
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<Esc>" = ":toggle-key-passthrough<Enter>";
|
||||
};
|
||||
|
||||
compose = {
|
||||
# Keybindings used when the embedded terminal is not selected in the compose
|
||||
# view
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<C-k>" = ":prev-field<Enter>";
|
||||
"<C-j>" = ":next-field<Enter>";
|
||||
"<A-p>" = ":switch-account -p<Enter>";
|
||||
"<A-n>" = ":switch-account -n<Enter>";
|
||||
"<tab>" = ":next-field<Enter>";
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
|
||||
"compose::editor" = {
|
||||
# Keybindings used when the embedded terminal is selected in the compose view
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<C-k>" = ":prev-field<Enter>";
|
||||
"<C-j>" = ":next-field<Enter>";
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
|
||||
"compose::review" = {
|
||||
# Keybindings used when reviewing a message to be sent
|
||||
y = ":send <Enter>";
|
||||
n = ":abort<Enter>";
|
||||
p = ":postpone<Enter>";
|
||||
q = ":choose -o d discard abort -o p postpone postpone<Enter>";
|
||||
e = ":edit<Enter>";
|
||||
a = ":attach<space>";
|
||||
d = ":detach<space>";
|
||||
};
|
||||
|
||||
terminal = {
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
};
|
||||
extraConfig = {
|
||||
general = {
|
||||
unsafe-accounts-conf = true;
|
||||
# log-file = "~/.cache/aerc.log";
|
||||
# log-level = "debug";
|
||||
};
|
||||
viewer = {
|
||||
pager = "${pkgs.less}/bin/less -R";
|
||||
};
|
||||
filters = {
|
||||
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||
"text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar";
|
||||
"text/html" =
|
||||
"${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
|
||||
# "text/*" =
|
||||
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
|
||||
"message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||
"message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
|
||||
"application/pdf" = "${pkgs.zathura}/bin/zathura -";
|
||||
"audio/*" = "${pkgs.mpv}/bin/mpv -";
|
||||
"image/*" = "${pkgs.feh}/bin/feh -";
|
||||
};
|
||||
};
|
||||
};
|
||||
accounts.email.accounts.home.aerc = {
|
||||
enable = true;
|
||||
extraAccounts = {
|
||||
check-mail = "5m";
|
||||
check-mail-cmd = "${pkgs.isync}/bin/mbsync -a";
|
||||
check-mail-timeout = "15s";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
|
||||
name = "aerc";
|
||||
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"
|
||||
''
|
||||
)
|
||||
}";
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
ae = "aerc";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
imports = [
|
||||
./himalaya.nix
|
||||
./aerc.nix
|
||||
./system.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
mail.enable = lib.mkEnableOption "Mail service.";
|
||||
mail.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;
|
||||
description = "Server name for the email address.";
|
||||
};
|
||||
mail.imapHost = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Server host for IMAP (reading mail).";
|
||||
};
|
||||
mail.smtpHost = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Server host for SMTP (sending mail).";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.mail.enable {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
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 = "${pkgs.notmuch}/bin/notmuch new";
|
||||
};
|
||||
|
||||
# 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;
|
||||
|
||||
# Better local mail search
|
||||
programs.notmuch = {
|
||||
enable = true;
|
||||
new.ignore = [
|
||||
".mbsyncstate.lock"
|
||||
".mbsyncstate.journal"
|
||||
".mbsyncstate.new"
|
||||
];
|
||||
};
|
||||
|
||||
accounts.email = {
|
||||
|
||||
# Where email files are stored
|
||||
maildirBasePath = "${config.homePath}/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"
|
||||
];
|
||||
|
||||
# Options for contact completion
|
||||
alot = { };
|
||||
|
||||
imap = {
|
||||
host = config.mail.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
|
||||
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
|
||||
};
|
||||
|
||||
# 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
|
||||
options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
|
||||
|
||||
config = lib.mkIf config.mail.himalaya.enable {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
programs.himalaya = {
|
||||
enable = true;
|
||||
};
|
||||
accounts.email.accounts.home.himalaya = {
|
||||
enable = true;
|
||||
settings = {
|
||||
downloads-dir = config.userDirs.download;
|
||||
smtp-insecure = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
hi = "himalaya";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
config = lib.mkIf (config.mail.enable || config.server) {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
programs.msmtp.enable = true;
|
||||
|
||||
# The system user for sending automatic notifications
|
||||
accounts.email.accounts.system =
|
||||
let
|
||||
address = "system@${config.mail.server}";
|
||||
in
|
||||
{
|
||||
userName = address;
|
||||
realName = "NixOS System";
|
||||
primary = !config.mail.enable; # Only primary if mail not enabled
|
||||
inherit address;
|
||||
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
|
||||
msmtp.enable = true;
|
||||
smtp = {
|
||||
host = config.mail.smtpHost;
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
|
||||
# Shell history sync
|
||||
|
||||
options.atuin.enable = lib.mkEnableOption "Atuin";
|
||||
|
||||
config = {
|
||||
|
||||
home-manager.users.${config.user} = lib.mkIf config.atuin.enable {
|
||||
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
flags = [
|
||||
"--disable-up-arrow"
|
||||
"--disable-ctrl-r"
|
||||
];
|
||||
settings = {
|
||||
auto_sync = true;
|
||||
update_check = false;
|
||||
sync_address = "https://api.atuin.sh";
|
||||
search_mode = "fuzzy";
|
||||
filter_mode = "host"; # global, host, session, directory
|
||||
search_mode_shell_up_key_binding = "fuzzy";
|
||||
filter_mode_shell_up_key_binding = "session";
|
||||
style = "compact"; # or auto,full
|
||||
show_help = true;
|
||||
history_filter = [ ];
|
||||
secrets_filter = true;
|
||||
enter_accept = false;
|
||||
keymap_mode = "vim-normal";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Give root user the same setup
|
||||
home-manager.users.root.programs.atuin = config.home-manager.users.${config.user}.programs.atuin;
|
||||
};
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
|
||||
# Enables quickly entering Nix shells when changing directories
|
||||
home-manager.users.${config.user}.programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config = {
|
||||
whitelist = {
|
||||
prefix = [ config.dotfilesPath ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# programs.direnv.direnvrcExtra = ''
|
||||
# layout_postgres() {
|
||||
# export PGDATA="$(direnv_layout_dir)/postgres"
|
||||
# export PGHOST="$PGDATA"
|
||||
#
|
||||
# if [[ ! -d "PGDATA" ]]; then
|
||||
# initdb
|
||||
# cat >> "$PGDATA/postgres.conf" <<- EOF
|
||||
# listen_addresses = '''
|
||||
# unix_socket_directories = '$PGHOST'
|
||||
# EOF
|
||||
# echo "CREATE DATABASE $USER;" | postgres --single -E postgres
|
||||
# fi
|
||||
# }
|
||||
# '';
|
||||
|
||||
# Prevent garbage collection
|
||||
nix.extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
home-packages = config.home-manager.users.${config.user}.home.packages;
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
gitName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Name to use for git commits";
|
||||
};
|
||||
gitEmail = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Email to use for git commits";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
home-manager.users.root.programs.git = {
|
||||
enable = true;
|
||||
extraConfig.safe.directory = config.dotfilesPath;
|
||||
};
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = config.gitName;
|
||||
userEmail = config.gitEmail;
|
||||
extraConfig = {
|
||||
core.pager = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F";
|
||||
interactive.difffilter = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight";
|
||||
pager = {
|
||||
branch = "false";
|
||||
};
|
||||
safe = {
|
||||
directory = config.dotfilesPath;
|
||||
};
|
||||
pull = {
|
||||
ff = "only";
|
||||
};
|
||||
push = {
|
||||
autoSetupRemote = "true";
|
||||
};
|
||||
init = {
|
||||
defaultBranch = "master";
|
||||
};
|
||||
rebase = {
|
||||
autosquash = "true";
|
||||
};
|
||||
gpg = {
|
||||
format = "ssh";
|
||||
ssh.allowedSignersFile = "~/.config/git/allowed-signers";
|
||||
};
|
||||
# commit.gpgsign = true;
|
||||
# tag.gpgsign = true;
|
||||
};
|
||||
ignores = [
|
||||
".direnv/**"
|
||||
"result"
|
||||
];
|
||||
includes = [
|
||||
{
|
||||
path = "~/.config/git/personal";
|
||||
condition = "gitdir:~/dev/personal/";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Personal git config
|
||||
# TODO: fix with variables
|
||||
xdg.configFile."git/personal".text = ''
|
||||
[user]
|
||||
name = "${config.fullName}"
|
||||
email = "7386960+nmasur@users.noreply.github.com"
|
||||
signingkey = ~/.ssh/id_ed25519
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[tag]
|
||||
gpgsign = true
|
||||
'';
|
||||
|
||||
xdg.configFile."git/allowed-signers".text = ''
|
||||
7386960+nmasur@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s
|
||||
'';
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
g = "git";
|
||||
gs = "git status";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gdp = "git diff HEAD^";
|
||||
ga = "git add";
|
||||
gaa = "git add -A";
|
||||
gac = "git commit -am";
|
||||
gc = "git commit -m";
|
||||
gca = "git commit --amend --no-edit";
|
||||
gcae = "git commit --amend";
|
||||
gu = "git pull";
|
||||
gp = "git push";
|
||||
gl = "git log --graph --decorate --oneline -20";
|
||||
gll = "git log --graph --decorate --oneline";
|
||||
gco = "git checkout";
|
||||
gcom = ''git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
|
||||
gcob = "git switch -c";
|
||||
gb = "git branch";
|
||||
gpd = "git push origin -d";
|
||||
gbd = "git branch -d";
|
||||
gbD = "git branch -D";
|
||||
gdd = {
|
||||
position = "anywhere";
|
||||
setCursor = true;
|
||||
expansion = "BRANCH=% git push origin -d $BRANCH and git branch -d $BRANCH";
|
||||
};
|
||||
gr = "git reset";
|
||||
grh = "git reset --hard";
|
||||
gm = "git merge";
|
||||
gcp = "git cherry-pick";
|
||||
cdg = "cd (git rev-parse --show-toplevel)";
|
||||
};
|
||||
|
||||
# Required for fish commands
|
||||
home.packages = with pkgs; [
|
||||
fish
|
||||
fzf
|
||||
bat
|
||||
];
|
||||
|
||||
programs.fish.functions =
|
||||
lib.mkIf (builtins.elem pkgs.fzf home-packages && builtins.elem pkgs.bat home-packages)
|
||||
{
|
||||
git = {
|
||||
body = builtins.readFile ./fish/functions/git.fish;
|
||||
};
|
||||
git-add-fuzzy = {
|
||||
body = builtins.readFile ./fish/functions/git-add-fuzzy.fish;
|
||||
};
|
||||
git-fuzzy-branch = {
|
||||
argumentNames = "header";
|
||||
body = builtins.readFile ./fish/functions/git-fuzzy-branch.fish;
|
||||
};
|
||||
git-checkout-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
'';
|
||||
};
|
||||
git-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-force-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
'';
|
||||
};
|
||||
git-delete-both = {
|
||||
argumentNames = "branch";
|
||||
body = ''
|
||||
git push origin -d $branch
|
||||
git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-merge-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
'';
|
||||
};
|
||||
git-show-fuzzy = {
|
||||
body = builtins.readFile ./fish/functions/git-show-fuzzy.fish;
|
||||
};
|
||||
git-commits = {
|
||||
body = builtins.readFile ./fish/functions/git-commits.fish;
|
||||
};
|
||||
git-history = {
|
||||
body = builtins.readFile ./fish/functions/git-history.fish;
|
||||
};
|
||||
uncommitted = {
|
||||
description = "Find uncommitted git repos";
|
||||
body = builtins.readFile ./fish/functions/uncommitted.fish;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
|
||||
config = {
|
||||
|
||||
home-manager.users.${config.user}.programs.jujutsu = {
|
||||
enable = true;
|
||||
|
||||
# https://github.com/martinvonz/jj/blob/main/docs/config.md
|
||||
settings = {
|
||||
user = {
|
||||
name = config.home-manager.users.${config.user}.programs.git.userName;
|
||||
email = config.home-manager.users.${config.user}.programs.git.userEmail;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
config = {
|
||||
|
||||
# MacOS-specific settings for Fish
|
||||
programs.fish.useBabelfish = true;
|
||||
programs.fish.babelfishPackage = pkgs.babelfish;
|
||||
};
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
# Hammerspoon - MacOS custom automation scripting
|
||||
|
||||
config = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua;
|
||||
xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = ./hammerspoon/Spoons/ControlEscape.spoon;
|
||||
xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = ./hammerspoon/Spoons/DismissAlerts.spoon;
|
||||
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = pkgs.substituteAll {
|
||||
src = ./hammerspoon/Spoons/Launcher.spoon/init.lua;
|
||||
firefox = "${pkgs.firefox-bin}/Applications/Firefox.app";
|
||||
discord = "${pkgs.discord}/Applications/Discord.app";
|
||||
wezterm = "${pkgs.wezterm}/Applications/WezTerm.app";
|
||||
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
|
||||
slack = "${pkgs.slack}/Applications/Slack.app";
|
||||
};
|
||||
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./hammerspoon/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()"
|
||||
'';
|
||||
};
|
||||
|
||||
homebrew.casks = [ "hammerspoon" ];
|
||||
|
||||
system.activationScripts.postUserActivation.text = ''
|
||||
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${config.homePath}/.config/hammerspoon/init.lua"
|
||||
sudo killall Dock
|
||||
'';
|
||||
};
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
# config = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
# networking = {
|
||||
# computerName = config.networking.hostName;
|
||||
# # Adjust if necessary
|
||||
# # hostName = "";
|
||||
# };
|
||||
# };
|
||||
# }
|
||||
}
|
@ -1,222 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
terminal = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Path to executable for terminal emulator program.";
|
||||
default = null;
|
||||
};
|
||||
terminalLaunchCommand = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Command for using the terminal to launch a new window with a program.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
# This setting only applies to Darwin, different on NixOS
|
||||
nix.gc.interval = {
|
||||
Hour = 12;
|
||||
Minute = 15;
|
||||
Day = 1;
|
||||
};
|
||||
|
||||
environment.shells = [ pkgs.fish ];
|
||||
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
|
||||
system = {
|
||||
|
||||
stateVersion = 5;
|
||||
|
||||
keyboard = {
|
||||
remapCapsLockToControl = true;
|
||||
enableKeyMapping = true; # Allows for skhd
|
||||
};
|
||||
|
||||
defaults = {
|
||||
NSGlobalDomain = {
|
||||
|
||||
# Set to dark mode
|
||||
AppleInterfaceStyle = "Dark";
|
||||
|
||||
# Don't change from dark to light automatically
|
||||
# AppleInterfaceSwitchesAutomatically = false;
|
||||
|
||||
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
|
||||
AppleKeyboardUIMode = 3;
|
||||
|
||||
# Only hide menu bar in fullscreen
|
||||
_HIHideMenuBar = false;
|
||||
|
||||
# Expand save panel by default
|
||||
NSNavPanelExpandedStateForSaveMode = true;
|
||||
|
||||
# Expand print panel by default
|
||||
PMPrintingExpandedStateForPrint = true;
|
||||
|
||||
# Replace press-and-hold with key repeat
|
||||
ApplePressAndHoldEnabled = false;
|
||||
|
||||
# Set a fast key repeat rate
|
||||
KeyRepeat = 2;
|
||||
|
||||
# Shorten delay before key repeat begins
|
||||
InitialKeyRepeat = 12;
|
||||
|
||||
# Save to local disk by default, not iCloud
|
||||
NSDocumentSaveNewDocumentsToCloud = false;
|
||||
|
||||
# Disable autocorrect capitalization
|
||||
NSAutomaticCapitalizationEnabled = false;
|
||||
|
||||
# Disable autocorrect smart dashes
|
||||
NSAutomaticDashSubstitutionEnabled = false;
|
||||
|
||||
# Disable autocorrect adding periods
|
||||
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||
|
||||
# Disable autocorrect smart quotation marks
|
||||
NSAutomaticQuoteSubstitutionEnabled = false;
|
||||
|
||||
# Disable autocorrect spellcheck
|
||||
NSAutomaticSpellingCorrectionEnabled = false;
|
||||
};
|
||||
|
||||
dock = {
|
||||
# Automatically show and hide the dock
|
||||
autohide = true;
|
||||
|
||||
# Add translucency in dock for hidden applications
|
||||
showhidden = true;
|
||||
|
||||
# Enable spring loading on all dock items
|
||||
enable-spring-load-actions-on-all-items = true;
|
||||
|
||||
# Highlight hover effect in dock stack grid view
|
||||
mouse-over-hilite-stack = true;
|
||||
|
||||
mineffect = "genie";
|
||||
orientation = "bottom";
|
||||
show-recents = false;
|
||||
tilesize = 44;
|
||||
|
||||
persistent-apps = [
|
||||
"/Applications/1Password.app"
|
||||
"${pkgs.slack}/Applications/Slack.app"
|
||||
"/System/Applications/Calendar.app"
|
||||
"${pkgs.firefox-bin}/Applications/Firefox.app"
|
||||
"/System/Applications/Messages.app"
|
||||
"/System/Applications/Mail.app"
|
||||
"/Applications/zoom.us.app"
|
||||
"${pkgs.discord}/Applications/Discord.app"
|
||||
"${pkgs.obsidian}/Applications/Obsidian.app"
|
||||
"${pkgs.wezterm}/Applications/WezTerm.app"
|
||||
];
|
||||
};
|
||||
|
||||
finder = {
|
||||
|
||||
# Default Finder window set to column view
|
||||
FXPreferredViewStyle = "clmv";
|
||||
|
||||
# Finder search in current folder by default
|
||||
FXDefaultSearchScope = "SCcf";
|
||||
|
||||
# Disable warning when changing file extension
|
||||
FXEnableExtensionChangeWarning = false;
|
||||
|
||||
# Allow quitting of Finder application
|
||||
QuitMenuItem = true;
|
||||
};
|
||||
|
||||
# Disable "Are you sure you want to open" dialog
|
||||
LaunchServices.LSQuarantine = false;
|
||||
|
||||
# Disable trackpad tap to click
|
||||
trackpad.Clicking = false;
|
||||
|
||||
# Where to save screenshots
|
||||
screencapture.location = "~/Downloads";
|
||||
|
||||
# Show seconds on the clock
|
||||
menuExtraClock.ShowSeconds = true;
|
||||
|
||||
CustomUserPreferences = {
|
||||
# Disable disk image verification
|
||||
"com.apple.frameworks.diskimages" = {
|
||||
skip-verify = true;
|
||||
skip-verify-locked = true;
|
||||
skip-verify-remote = true;
|
||||
};
|
||||
# Avoid creating .DS_Store files on network or USB volumes
|
||||
"com.apple.desktopservices" = {
|
||||
DSDontWriteNetworkStores = true;
|
||||
DSDontWriteUSBStores = true;
|
||||
};
|
||||
"com.apple.dock" = {
|
||||
magnification = true;
|
||||
largesize = 48;
|
||||
};
|
||||
# Require password immediately after screen saver begins
|
||||
"com.apple.screensaver" = {
|
||||
askForPassword = 1;
|
||||
askForPasswordDelay = 0;
|
||||
};
|
||||
"com.apple.finder" = {
|
||||
# Disable the warning before emptying the Trash
|
||||
WarnOnEmptyTrash = false;
|
||||
|
||||
# Finder search in current folder by default
|
||||
FXDefaultSearchScope = "SCcf";
|
||||
|
||||
# Default Finder window set to column view
|
||||
FXPreferredViewStyle = "clmv";
|
||||
};
|
||||
"leits.MeetingBar" = {
|
||||
eventTimeFormat = ''"show"'';
|
||||
eventTitleFormat = ''"none"'';
|
||||
eventTitleIconFormat = ''"iconCalendar"'';
|
||||
slackBrowser = ''{"deletable":true,"arguments":"","name":"Slack","path":""}'';
|
||||
zoomBrowser = ''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
|
||||
teamsBrowser = ''{"deletable":true,"arguments":"","name":"Teams","path":""}'';
|
||||
KeyboardShortcuts_joinEventShortcut = ''{"carbonModifiers":6400,"carbonKeyCode":38}'';
|
||||
timeFormat = ''"12-hour"'';
|
||||
};
|
||||
};
|
||||
|
||||
CustomSystemPreferences = {
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
# Settings that don't have an option in nix-darwin
|
||||
activationScripts.postActivation.text = ''
|
||||
echo "Allow apps from anywhere"
|
||||
SPCTL=$(spctl --status)
|
||||
if ! [ "$SPCTL" = "assessments disabled" ]; then
|
||||
sudo spctl --master-disable
|
||||
fi
|
||||
'';
|
||||
|
||||
# User-level settings
|
||||
activationScripts.postUserActivation.text = ''
|
||||
echo "Show the ~/Library folder"
|
||||
chflags nohidden ~/Library
|
||||
|
||||
echo "Reduce Menu Bar padding"
|
||||
defaults write -globalDomain NSStatusItemSelectionPadding -int 6
|
||||
defaults write -globalDomain NSStatusItemSpacing -int 6
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -60,13 +60,5 @@
|
||||
})
|
||||
];
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
# Add noti for ghpr in Darwin
|
||||
ghpr = lib.mkForce "gh pr create && sleep 3 && noti gh run watch";
|
||||
grw = lib.mkForce "noti gh run watch";
|
||||
|
||||
# Shortcut to edit hosts file
|
||||
hosts = "sudo nvim /etc/hosts";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
calendar = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable calendar.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.calendar.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
accounts.calendar.accounts.default = {
|
||||
basePath = "other/calendars"; # Where to save calendars in ~ directory
|
||||
name = "personal";
|
||||
local.type = "filesystem";
|
||||
primary = true;
|
||||
remote = {
|
||||
passwordCommand = [ "" ];
|
||||
type = "caldav";
|
||||
url = "https://${config.hostnames.content}/remote.php/dav/principals/users/${config.user}";
|
||||
userName = config.user;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [ gnome-calendar ];
|
||||
};
|
||||
};
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
calibre = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Calibre.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.gui.enable && config.calibre.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = with pkgs; [ calibre ];
|
||||
# home.sessionVariables = { CALIBRE_USE_DARK_PALETTE = 1; };
|
||||
};
|
||||
|
||||
# Forces Calibre to use dark mode
|
||||
environment.sessionVariables = {
|
||||
CALIBRE_USE_DARK_PALETTE = "1";
|
||||
};
|
||||
};
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
|
||||
imports = [
|
||||
./calendar.nix
|
||||
./calibre.nix
|
||||
./nautilus.nix
|
||||
];
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options = {
|
||||
nautilus = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Nautilus file manager.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Install Nautilus file manager
|
||||
config = lib.mkIf (config.gui.enable && config.nautilus.enable) {
|
||||
|
||||
# Quick preview with spacebar
|
||||
services.gnome.sushi.enable = true;
|
||||
environment.systemPackages = [ pkgs.nautilus ];
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
# Quick button for launching nautilus
|
||||
xsession.windowManager.i3.config.keybindings = {
|
||||
"${
|
||||
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
|
||||
}+n" = "exec --no-startup-id ${pkgs.nautilus}/bin/nautilus";
|
||||
};
|
||||
|
||||
# Generates a QR code and previews it with sushi
|
||||
programs.fish.functions = {
|
||||
qr = {
|
||||
body = "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.sushi}/bin/sushi /tmp/qr.png";
|
||||
};
|
||||
};
|
||||
|
||||
# Set Nautilus as default for opening directories
|
||||
xdg.mimeApps = {
|
||||
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
|
||||
defaultApplications."inode/directory" = lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
|
||||
};
|
||||
};
|
||||
|
||||
# Delete Trash files older than 1 week
|
||||
systemd.user.services.empty-trash = {
|
||||
description = "Empty Trash on a regular basis";
|
||||
wantedBy = [ "default.target" ];
|
||||
script = "${pkgs.trash-cli}/bin/trash-empty 7";
|
||||
};
|
||||
};
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
options.gaming.chiaki.enable = lib.mkEnableOption "Chiaki PlayStation remote play client.";
|
||||
|
||||
config = lib.mkIf config.gaming.chiaki.enable {
|
||||
environment.systemPackages = with pkgs; [ chiaki ];
|
||||
};
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
|
||||
config = {
|
||||
|
||||
home-manager.users.${config.user}.services.dunst = {
|
||||
enable = false;
|
||||
settings = {
|
||||
global = {
|
||||
width = 300;
|
||||
height = 200;
|
||||
offset = "30x50";
|
||||
origin = "top-right";
|
||||
transparency = 0;
|
||||
padding = 20;
|
||||
horizontal_padding = 20;
|
||||
frame_color = config.theme.colors.base03;
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
timeout = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
services.picom = {
|
||||
enable = true;
|
||||
backend = "glx";
|
||||
settings = {
|
||||
blur = false;
|
||||
blurExclude = [ ];
|
||||
inactiveDim = "0.05";
|
||||
noDNDShadow = false;
|
||||
noDockShadow = false;
|
||||
# shadow-radius = 20
|
||||
# '';
|
||||
# shadow-radius = 20
|
||||
# corner-radius = 10
|
||||
# blur-size = 20
|
||||
# rounded-corners-exclude = [
|
||||
# "window_type = 'dock'",
|
||||
# "class_g = 'i3-frame'"
|
||||
# ]
|
||||
# '';
|
||||
};
|
||||
fade = false;
|
||||
inactiveOpacity = 1.0;
|
||||
menuOpacity = 1.0;
|
||||
opacityRules = [
|
||||
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
|
||||
];
|
||||
shadow = false;
|
||||
shadowExclude = [ ];
|
||||
shadowOffsets = [
|
||||
(-10)
|
||||
(-10)
|
||||
];
|
||||
shadowOpacity = 0.5;
|
||||
vSync = true;
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [
|
||||
{
|
||||
command = "systemctl --user restart picom";
|
||||
always = true;
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -1,235 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
|
||||
toggleBarCommand = "polybar-msg cmd toggle";
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
services.polybar = {
|
||||
enable = true;
|
||||
package = pkgs.polybar.override {
|
||||
pulseSupport = true;
|
||||
githubSupport = true;
|
||||
i3Support = true;
|
||||
};
|
||||
script = "polybar &";
|
||||
config = {
|
||||
"bar/main" = {
|
||||
bottom = false;
|
||||
width = "100%";
|
||||
height = "22pt";
|
||||
radius = 0;
|
||||
# offset-y = -5;
|
||||
# offset-y = "5%";
|
||||
# dpi = 96;
|
||||
background = config.theme.colors.base01;
|
||||
foreground = config.theme.colors.base05;
|
||||
line-size = "3pt";
|
||||
border-top-size = 0;
|
||||
border-right-size = 0;
|
||||
border-left-size = 0;
|
||||
border-bottom-size = "4pt";
|
||||
border-color = config.theme.colors.base00;
|
||||
padding-left = 2;
|
||||
padding-right = 2;
|
||||
module-margin = 1;
|
||||
modules-left = "i3";
|
||||
modules-center = "xwindow";
|
||||
modules-right = "mailcount network pulseaudio date power";
|
||||
cursor-click = "pointer";
|
||||
cursor-scroll = "ns-resize";
|
||||
enable-ipc = true;
|
||||
tray-position = "right";
|
||||
# wm-restack = "generic";
|
||||
# wm-restack = "bspwm";
|
||||
# wm-restack = "i3";
|
||||
# override-redirect = true;
|
||||
};
|
||||
"module/i3" =
|
||||
let
|
||||
padding = 2;
|
||||
in
|
||||
{
|
||||
type = "internal/i3";
|
||||
pin-workspaces = false;
|
||||
show-urgent = true;
|
||||
strip-wsnumbers = true;
|
||||
index-sort = true;
|
||||
enable-click = true;
|
||||
wrapping-scroll = true;
|
||||
fuzzy-match = true;
|
||||
format = "<label-state> <label-mode>";
|
||||
label-focused = "%name%";
|
||||
label-focused-foreground = config.theme.colors.base01;
|
||||
label-focused-background = config.theme.colors.base05;
|
||||
label-focused-underline = config.theme.colors.base03;
|
||||
label-focused-padding = padding;
|
||||
label-unfocused = "%name%";
|
||||
label-unfocused-padding = padding;
|
||||
label-visible = "%name%";
|
||||
label-visible-underline = config.theme.colors.base01;
|
||||
label-visible-padding = padding;
|
||||
label-urgent = "%name%";
|
||||
label-urgent-foreground = config.theme.colors.base00;
|
||||
label-urgent-background = config.theme.colors.base08;
|
||||
label-urgent-underline = config.theme.colors.base0F;
|
||||
label-urgent-padding = padding;
|
||||
};
|
||||
"module/xworkspaces" = {
|
||||
type = "internal/xworkspaces";
|
||||
label-active = "%name%";
|
||||
label-active-background = config.theme.colors.base05;
|
||||
label-active-foreground = config.theme.colors.base01;
|
||||
label-active-underline = config.theme.colors.base03;
|
||||
label-active-padding = 1;
|
||||
label-occupied = "%name%";
|
||||
label-occupied-padding = 1;
|
||||
label-urgent = "%name%";
|
||||
label-urgent-background = config.theme.colors.base08;
|
||||
label-urgent-padding = 1;
|
||||
label-empty = "%name%";
|
||||
label-empty-foreground = config.theme.colors.base06;
|
||||
label-empty-padding = 1;
|
||||
};
|
||||
"module/xwindow" = {
|
||||
type = "internal/xwindow";
|
||||
label = "%title:0:60:...%";
|
||||
};
|
||||
# "module/filesystem" = {
|
||||
# type = "internal/fs";
|
||||
# interval = 25;
|
||||
# mount-0 = "/";
|
||||
# label-mounted = "%{F#F0C674}%mountpoint%%{F-} %percentage_used%%";
|
||||
# label-unmounted = "%mountpoint% not mounted";
|
||||
# label-unmounted-foreground = colors.disabled;
|
||||
# };
|
||||
"module/mailcount" = {
|
||||
type = "custom/script";
|
||||
interval = 10;
|
||||
format = "<label>";
|
||||
exec = builtins.toString (
|
||||
pkgs.writeShellScript "mailcount.sh" ''
|
||||
${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null
|
||||
UNREAD=$(
|
||||
${pkgs.notmuch}/bin/notmuch count \
|
||||
is:inbox and \
|
||||
is:unread and \
|
||||
folder:main/Inbox \
|
||||
2>/dev/null
|
||||
)
|
||||
if [ $UNREAD = "0" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo "%{T2}%{T-} $UNREAD "
|
||||
fi
|
||||
''
|
||||
);
|
||||
click-left = "i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
|
||||
};
|
||||
"module/network" = {
|
||||
type = "internal/network";
|
||||
interface-type = "wired";
|
||||
interval = 3;
|
||||
accumulate-stats = true;
|
||||
format-connected = "<label-connected>";
|
||||
format-disconnected = "<label-disconnected>";
|
||||
label-connected = "";
|
||||
label-disconnected = "";
|
||||
};
|
||||
"module/pulseaudio" = {
|
||||
type = "internal/pulseaudio";
|
||||
# format-volume-prefix = "VOL ";
|
||||
# format-volume-prefix-foreground = colors.primary;
|
||||
format-volume = "<ramp-volume> <label-volume>";
|
||||
# format-volume-background = colors.background;
|
||||
# label-volume-background = colors.background;
|
||||
format-volume-foreground = config.theme.colors.base04;
|
||||
label-volume = "%percentage%%";
|
||||
label-muted = " ---";
|
||||
label-muted-foreground = config.theme.colors.base03;
|
||||
ramp-volume-0 = "";
|
||||
ramp-volume-1 = "";
|
||||
ramp-volume-2 = "";
|
||||
click-right = config.audioSwitchCommand;
|
||||
};
|
||||
# "module/xkeyboard" = {
|
||||
# type = "internal/xkeyboard";
|
||||
# blacklist-0 = "num lock";
|
||||
# label-layout = "%layout%";
|
||||
# label-layout-foreground = colors.primary;
|
||||
# label-indicator-padding = 2;
|
||||
# label-indicator-margin = 1;
|
||||
# label-indicator-foreground = colors.background;
|
||||
# label-indicator-background = colors.secondary;
|
||||
# };
|
||||
# "module/memory" = {
|
||||
# type = "internal/memory";
|
||||
# interval = 2;
|
||||
# format-prefix = "RAM ";
|
||||
# format-prefix-foreground = colors.primary;
|
||||
# label = "%percentage_used:2%%";
|
||||
# };
|
||||
# "module/cpu" = {
|
||||
# type = "internal/cpu";
|
||||
# interval = 2;
|
||||
# format-prefix = "CPU ";
|
||||
# format-prefix-foreground = colors.primary;
|
||||
# label = "%percentage:2%%";
|
||||
# };
|
||||
# "network-base" = {
|
||||
# type = "internal/network";
|
||||
# interval = 5;
|
||||
# format-connected = "<label-connected>";
|
||||
# format-disconnected = "<label-disconnected>";
|
||||
# label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected";
|
||||
# };
|
||||
# "module/wlan" = {
|
||||
# "inherit" = "network-base";
|
||||
# interface-type = "wireless";
|
||||
# label-connected = "%{F#F0C674}%ifname%%{F-} %essid% %local_ip%";
|
||||
# };
|
||||
# "module/eth" = {
|
||||
# "inherit" = "network-base";
|
||||
# interface-type = "wired";
|
||||
# label-connected = "%{F#F0C674}%ifname%%{F-} %local_ip%";
|
||||
# };
|
||||
"module/date" = {
|
||||
type = "internal/date";
|
||||
interval = 1;
|
||||
date = "%d %b %l:%M %p";
|
||||
date-alt = "%Y-%m-%d %H:%M:%S";
|
||||
label = "%date%";
|
||||
label-foreground = config.theme.colors.base06;
|
||||
# format-background = colors.background;
|
||||
};
|
||||
"module/power" = {
|
||||
type = "custom/text";
|
||||
content = " ";
|
||||
click-left = config.powerCommand;
|
||||
click-right = "polybar-msg cmd restart";
|
||||
content-foreground = config.theme.colors.base04;
|
||||
};
|
||||
"settings" = {
|
||||
screenchange-reload = true;
|
||||
pseudo-transparency = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [
|
||||
{
|
||||
command = "pkill polybar; polybar -r main";
|
||||
always = true;
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs."1password";
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs."1password".enable =
|
||||
lib.mkEnableOption "1Password password manager";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
unfreePackages = [
|
||||
"1password"
|
||||
"_1password-gui"
|
||||
"1password-cli"
|
||||
"onepassword-password-manager" # Firefox extension
|
||||
];
|
||||
home.packages = [
|
||||
pkgs._1password-cli
|
||||
] ++ (if pkgs.stdenv.isLinux then [ pkgs._1password-gui ] else [ ]);
|
||||
|
||||
# Firefox extension
|
||||
programs.firefox.profiles.default.extensions =
|
||||
pkgs.nur.repos.rycee.firefox-addons.onepassword-password-manager;
|
||||
};
|
||||
|
||||
# # https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app
|
||||
# # On Mac, does not apply: https://1password.community/discussion/142794/app-and-browser-integration
|
||||
# # However, the button doesn't work either:
|
||||
# # https://1password.community/discussion/140735/extending-support-for-trusted-web-browsers
|
||||
# environment.etc."1password/custom_allowed_browsers".text = ''
|
||||
# ${
|
||||
# config.home-manager.users.${config.user}.programs.firefox.package
|
||||
# }/Applications/Firefox.app/Contents/MacOS/firefox
|
||||
# firefox
|
||||
# '';
|
||||
}
|
223
platforms/home-manager/modules/nmasur/presets/programs/aerc.nix
Normal file
223
platforms/home-manager/modules/nmasur/presets/programs/aerc.nix
Normal file
@ -0,0 +1,223 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.aerc;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.aerc.enable = lib.mkEnableOption "Aerc email TUI";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
w3m # Render HTML
|
||||
dante # Socksify for rendering HTML
|
||||
];
|
||||
|
||||
programs.aerc = {
|
||||
enable = true;
|
||||
extraBinds = {
|
||||
# Binds are of the form <key sequence> = <command to run>
|
||||
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
|
||||
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
|
||||
global = {
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab <Enter>";
|
||||
"<C-t>" = ":term<Enter>";
|
||||
"?" = ":help keys<Enter>";
|
||||
};
|
||||
|
||||
messages = {
|
||||
q = ":quit<Enter>";
|
||||
|
||||
j = ":next <Enter>";
|
||||
"<Down>" = ":next<Enter>";
|
||||
"<C-d>" = ":next 50%<Enter>";
|
||||
"<C-f>" = ":next 100%<Enter>";
|
||||
"<PgDn>" = ":next 100%<Enter>";
|
||||
|
||||
k = ":prev <Enter>";
|
||||
"<Up>" = ":prev<Enter>";
|
||||
"<C-u>" = ":prev 50%<Enter>";
|
||||
"<C-b>" = ":prev 100%<Enter>";
|
||||
"<PgUp>" = ":prev 100%<Enter>";
|
||||
g = ":select 0 <Enter>";
|
||||
G = ":select -1<Enter>";
|
||||
|
||||
J = ":next-folder <Enter>";
|
||||
K = ":prev-folder<Enter>";
|
||||
H = ":collapse-folder<Enter>";
|
||||
L = ":expand-folder<Enter>";
|
||||
|
||||
v = ":mark -t<Enter>";
|
||||
V = ":mark -v<Enter>";
|
||||
|
||||
T = ":toggle-threads<Enter>";
|
||||
|
||||
"<Enter>" = ":view<Enter>";
|
||||
d = ":prompt 'Really delete this message?' 'delete-message'<Enter>";
|
||||
D = ":move Trash<Enter>";
|
||||
A = ":archive flat<Enter>";
|
||||
|
||||
C = ":compose<Enter>";
|
||||
|
||||
rr = ":reply -a<Enter>";
|
||||
rq = ":reply -aq<Enter>";
|
||||
Rr = ":reply<Enter>";
|
||||
Rq = ":reply -q<Enter>";
|
||||
|
||||
c = ":cf<space>";
|
||||
"$" = ":term<space>";
|
||||
"!" = ":term<space>";
|
||||
"|" = ":pipe<space>";
|
||||
|
||||
"/" = ":search<space>-a<space>";
|
||||
"\\" = ":filter <space>";
|
||||
n = ":next-result<Enter>";
|
||||
N = ":prev-result<Enter>";
|
||||
"<Esc>" = ":clear<Enter>";
|
||||
};
|
||||
|
||||
"messages:folder=Drafts" = {
|
||||
"<Enter>" = ":recall<Enter>";
|
||||
};
|
||||
|
||||
view = {
|
||||
"/" = ":toggle-key-passthrough <Enter> /";
|
||||
q = ":close<Enter>";
|
||||
O = ":open<Enter>";
|
||||
S = ":save<space>";
|
||||
"|" = ":pipe<space>";
|
||||
D = ":move Trash<Enter>";
|
||||
A = ":archive flat<Enter>";
|
||||
|
||||
"<C-l>" = ":open-link <space>";
|
||||
|
||||
f = ":forward <Enter>";
|
||||
rr = ":reply -a<Enter>";
|
||||
rq = ":reply -aq<Enter>";
|
||||
Rr = ":reply<Enter>";
|
||||
Rq = ":reply -q<Enter>";
|
||||
|
||||
H = ":toggle-headers<Enter>";
|
||||
"<C-k>" = ":prev-part<Enter>";
|
||||
"<C-j>" = ":next-part<Enter>";
|
||||
J = ":next <Enter>";
|
||||
K = ":prev<Enter>";
|
||||
};
|
||||
|
||||
"view::passthrough" = {
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<Esc>" = ":toggle-key-passthrough<Enter>";
|
||||
};
|
||||
|
||||
compose = {
|
||||
# Keybindings used when the embedded terminal is not selected in the compose
|
||||
# view
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<C-k>" = ":prev-field<Enter>";
|
||||
"<C-j>" = ":next-field<Enter>";
|
||||
"<A-p>" = ":switch-account -p<Enter>";
|
||||
"<A-n>" = ":switch-account -n<Enter>";
|
||||
"<tab>" = ":next-field<Enter>";
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
|
||||
"compose::editor" = {
|
||||
# Keybindings used when the embedded terminal is selected in the compose view
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<C-k>" = ":prev-field<Enter>";
|
||||
"<C-j>" = ":next-field<Enter>";
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
|
||||
"compose::review" = {
|
||||
# Keybindings used when reviewing a message to be sent
|
||||
y = ":send <Enter>";
|
||||
n = ":abort<Enter>";
|
||||
p = ":postpone<Enter>";
|
||||
q = ":choose -o d discard abort -o p postpone postpone<Enter>";
|
||||
e = ":edit<Enter>";
|
||||
a = ":attach<space>";
|
||||
d = ":detach<space>";
|
||||
};
|
||||
|
||||
terminal = {
|
||||
"$noinherit" = "true";
|
||||
"$ex" = "<C-x>";
|
||||
"<C-p>" = ":prev-tab<Enter>";
|
||||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
};
|
||||
extraConfig = {
|
||||
general = {
|
||||
unsafe-accounts-conf = true;
|
||||
# log-file = "~/.cache/aerc.log";
|
||||
# log-level = "debug";
|
||||
};
|
||||
viewer = {
|
||||
pager = "${pkgs.less}/bin/less -R";
|
||||
};
|
||||
filters = {
|
||||
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||
"text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar";
|
||||
"text/html" =
|
||||
"${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
|
||||
# "text/*" =
|
||||
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
|
||||
"message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||
"message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
|
||||
"application/pdf" = "${pkgs.zathura}/bin/zathura -";
|
||||
"audio/*" = "${pkgs.mpv}/bin/mpv -";
|
||||
"image/*" = "${pkgs.feh}/bin/feh -";
|
||||
};
|
||||
};
|
||||
};
|
||||
accounts.email.accounts.home.aerc = {
|
||||
enable = true;
|
||||
extraAccounts = {
|
||||
check-mail = "5m";
|
||||
check-mail-cmd = "${pkgs.isync}/bin/mbsync -a";
|
||||
check-mail-timeout = "15s";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
|
||||
name = "aerc";
|
||||
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"
|
||||
''
|
||||
)
|
||||
}";
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
ae = "aerc";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.alacritty;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.alacritty.enable = lib.mkEnableOption "Alacritty terminal";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
window = {
|
||||
dimensions = {
|
||||
columns = 85;
|
||||
lines = 30;
|
||||
};
|
||||
padding = {
|
||||
x = 20;
|
||||
y = 20;
|
||||
};
|
||||
opacity = 1.0;
|
||||
};
|
||||
scrolling.history = 10000;
|
||||
font = {
|
||||
size = 14.0;
|
||||
};
|
||||
key_bindings = [
|
||||
# Used for word completion in fish_user_key_bindings
|
||||
{
|
||||
key = "Return";
|
||||
mods = "Shift";
|
||||
chars = "\\x1F";
|
||||
}
|
||||
# Used for searching nixpkgs in fish_user_key_bindings
|
||||
{
|
||||
key = "N";
|
||||
mods = "Control|Shift";
|
||||
chars = "\\x11F";
|
||||
}
|
||||
{
|
||||
key = "H";
|
||||
mods = "Control|Shift";
|
||||
mode = "~Vi";
|
||||
action = "ToggleViMode";
|
||||
}
|
||||
{
|
||||
key = "Return";
|
||||
mode = "Vi";
|
||||
action = "ToggleViMode";
|
||||
}
|
||||
# Used to enable $ keybind in Vi mode
|
||||
{
|
||||
key = 5; # Scancode for key4
|
||||
mods = "Shift";
|
||||
mode = "Vi|~Search";
|
||||
action = "Last";
|
||||
}
|
||||
];
|
||||
colors = {
|
||||
primary = {
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
};
|
||||
cursor = {
|
||||
text = "#1d2021";
|
||||
cursor = config.theme.colors.base05;
|
||||
};
|
||||
normal = {
|
||||
black = "#1d2021";
|
||||
red = config.theme.colors.base08;
|
||||
green = config.theme.colors.base0B;
|
||||
yellow = config.theme.colors.base0A;
|
||||
blue = config.theme.colors.base0D;
|
||||
magenta = config.theme.colors.base0E;
|
||||
cyan = config.theme.colors.base0C;
|
||||
white = config.theme.colors.base05;
|
||||
};
|
||||
bright = {
|
||||
black = config.theme.colors.base03;
|
||||
red = config.theme.colors.base09;
|
||||
green = config.theme.colors.base01;
|
||||
yellow = config.theme.colors.base02;
|
||||
blue = config.theme.colors.base04;
|
||||
magenta = config.theme.colors.base06;
|
||||
cyan = config.theme.colors.base0F;
|
||||
white = config.theme.colors.base07;
|
||||
};
|
||||
};
|
||||
draw_bold_text_with_bright_colors = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.atuin;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.atuin.enable = lib.mkEnableOption "Atuin shell history sync";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
flags = [
|
||||
"--disable-up-arrow"
|
||||
"--disable-ctrl-r"
|
||||
];
|
||||
settings = {
|
||||
auto_sync = true;
|
||||
update_check = false;
|
||||
sync_address = "https://api.atuin.sh";
|
||||
search_mode = "fuzzy";
|
||||
filter_mode = "host"; # global, host, session, directory
|
||||
search_mode_shell_up_key_binding = "fuzzy";
|
||||
filter_mode_shell_up_key_binding = "session";
|
||||
style = "compact"; # or auto,full
|
||||
show_help = true;
|
||||
history_filter = [ ];
|
||||
secrets_filter = true;
|
||||
enter_accept = false;
|
||||
keymap_mode = "vim-normal";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.bash;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.bash.enable = lib.mkEnableOption "Bash shell";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
shellAliases = config.programs.fish.shellAliases;
|
||||
initExtra = "";
|
||||
profileExtra = "";
|
||||
};
|
||||
|
||||
programs.starship.enableBashIntegration = false;
|
||||
programs.zoxide.enableBashIntegration = true;
|
||||
programs.fzf.enableBashIntegration = true;
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.bat;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.bat.enable = lib.mkEnableOption "Bat text pager";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.bat = {
|
||||
enable = true; # cat replacement
|
||||
config = {
|
||||
theme = config.theme.colors.batTheme;
|
||||
pager = "less -R"; # Don't auto-exit if one screen
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.calibre;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.calibre.enable = lib.mkEnableOption "Calibre e-book manager";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ pkgs.calibre ];
|
||||
home.sessionVariables = {
|
||||
CALIBRE_USE_DARK_PALETTE = 1;
|
||||
};
|
||||
};
|
||||
}
|
@ -8,10 +8,9 @@
|
||||
./firefox.nix
|
||||
./kitty.nix
|
||||
./media.nix
|
||||
./obsidian.nix
|
||||
./qbittorrent.nix
|
||||
./slack.nix
|
||||
./nsxiv.nix
|
||||
./wezterm.nix
|
||||
./yt-dlp.nix
|
||||
./zathura.nix
|
||||
];
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.direnv;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.direnv.enable = lib.mkEnableOption "Direnv project-level shells";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Enables quickly entering Nix shells when changing directories
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config = {
|
||||
whitelist = {
|
||||
prefix = [ config.nmasur.dotfilesPath ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.discord;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.discord.enable = lib.mkEnableOption "Discord chat";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
unfreePackages = [ "discord" ];
|
||||
home.packages = [ pkgs.discord ];
|
||||
xdg.configFile."discord/settings.json".text = pkgs.formats.json {
|
||||
BACKGROUND_COLOR = "#202225";
|
||||
IS_MAXIMIZED = false;
|
||||
IS_MINIMIZED = false;
|
||||
OPEN_ON_STARTUP = false;
|
||||
MINIMIZE_TO_TRAY = false;
|
||||
SKIP_HOST_UPDATE = true;
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.fd;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.fd.enable = lib.mkEnableOption "fd file search tool";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ pkgs.fd ];
|
||||
xdg.configFile."fd/ignore".text = config.nmasur.presets.programs.ripgrep.ignorePatterns;
|
||||
};
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.firefox;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.firefox = {
|
||||
enable = lib.mkEnableOption "Firefox web browser";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
unfreePackages = [
|
||||
"okta-browser-plugin"
|
||||
];
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package = if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
|
||||
profiles.default = {
|
||||
id = 0;
|
||||
name = "default";
|
||||
isDefault = true;
|
||||
# https://nur.nix-community.org/repos/rycee/
|
||||
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
||||
bypass-paywalls-clean
|
||||
darkreader
|
||||
don-t-fuck-with-paste
|
||||
export-cookies-txt
|
||||
facebook-container
|
||||
markdownload
|
||||
multi-account-containers
|
||||
# obsidian-web-clipper TODO
|
||||
okta-browser-plugin # TODO: only for work profile
|
||||
reddit-enhancement-suite
|
||||
return-youtube-dislikes
|
||||
sponsorblock
|
||||
ublock-origin
|
||||
ublacklist
|
||||
vimium
|
||||
wappalyzer # TODO: only for work profile
|
||||
# saml-tracer
|
||||
# text-fragment
|
||||
];
|
||||
settings = {
|
||||
"app.update.auto" = false;
|
||||
"browser.aboutConfig.showWarning" = false;
|
||||
"browser.warnOnQuit" = false;
|
||||
"browser.quitShortcut.disabled" = if pkgs.stdenv.isLinux then true else false;
|
||||
"browser.theme.dark-private-windows" = true;
|
||||
"browser.toolbars.bookmarks.visibility" = false;
|
||||
"browser.startup.page" = 3; # Restore previous session
|
||||
"browser.newtabpage.enabled" = false; # Make new tabs blank
|
||||
"trailhead.firstrun.didSeeAboutWelcome" = true; # Disable welcome splash
|
||||
"dom.forms.autocomplete.formautofill" = false; # Disable autofill
|
||||
"extensions.formautofill.creditCards.enabled" = false; # Disable credit cards
|
||||
"dom.payments.defaults.saveAddress" = false; # Disable address save
|
||||
"general.autoScroll" = true; # Drag middle-mouse to scroll
|
||||
"services.sync.prefs.sync.general.autoScroll" = false; # Prevent disabling autoscroll
|
||||
"extensions.pocket.enabled" = false;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
|
||||
"layout.css.color-mix.enabled" = true;
|
||||
"ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
|
||||
"media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
|
||||
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
|
||||
"devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page
|
||||
"svg.context-properties.content.enabled" = true; # Sidebery styling
|
||||
"browser.tabs.hoverPreview.enabled" = false; # Disable tab previews
|
||||
"browser.tabs.hoverPreview.showThumbnails" = false; # Disable tab previews
|
||||
};
|
||||
userChrome = ''
|
||||
:root {
|
||||
--focus-outline-color: ${config.theme.colors.base04} !important;
|
||||
--toolbar-color: ${config.theme.colors.base07} !important;
|
||||
--tab-min-height: 30px !important;
|
||||
}
|
||||
/* Background of tab bar */
|
||||
.toolbar-items {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
}
|
||||
/* Extra tab bar sides on macOS */
|
||||
.titlebar-spacer {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
}
|
||||
.titlebar-buttonbox-container {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
}
|
||||
#tabbrowser-tabs {
|
||||
border-inline-start: 0 !important;
|
||||
}
|
||||
/* Private Browsing indicator on macOS */
|
||||
#private-browsing-indicator-with-label {
|
||||
background-color: ${config.theme.colors.base00} !important;
|
||||
margin-inline: 0 !important;
|
||||
padding-inline: 7px;
|
||||
}
|
||||
/* Tabs themselves */
|
||||
.tabbrowser-tab .tab-stack {
|
||||
border-radius: 5px 5px 0 0;
|
||||
overflow: hidden;
|
||||
background-color: ${config.theme.colors.base00};
|
||||
color: ${config.theme.colors.base06} !important;
|
||||
}
|
||||
.tab-content {
|
||||
border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 40%, transparent);
|
||||
border-radius: 5px 5px 0 0;
|
||||
background-color: ${config.theme.colors.base00};
|
||||
color: ${config.theme.colors.base06} !important;
|
||||
}
|
||||
.tab-content[selected] {
|
||||
border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent);
|
||||
background-color: ${config.theme.colors.base01} !important;
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
}
|
||||
/* Below tab bar */
|
||||
#nav-bar {
|
||||
background: ${config.theme.colors.base01} !important;
|
||||
}
|
||||
/* URL bar in nav bar */
|
||||
#urlbar[focused=true] {
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
background: ${config.theme.colors.base02} !important;
|
||||
caret-color: ${config.theme.colors.base05} !important;
|
||||
}
|
||||
#urlbar:not([focused=true]) {
|
||||
color: ${config.theme.colors.base04} !important;
|
||||
background: ${config.theme.colors.base02} !important;
|
||||
}
|
||||
#urlbar ::-moz-selection {
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
background: ${config.theme.colors.base02} !important;
|
||||
}
|
||||
#urlbar-input-container {
|
||||
border: 1px solid ${config.theme.colors.base01} !important;
|
||||
}
|
||||
#urlbar-background {
|
||||
background: ${config.theme.colors.base01} !important;
|
||||
}
|
||||
/* Text in URL bar */
|
||||
#urlbar-input, #urlbar-scheme, .searchbar-textbox {
|
||||
color: ${config.theme.colors.base07} !important;
|
||||
}
|
||||
'';
|
||||
userContent = ''
|
||||
@-moz-document url-prefix(about:blank) {
|
||||
* {
|
||||
background-color:${config.theme.colors.base01} !important;
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
extraConfig = "";
|
||||
};
|
||||
};
|
||||
|
||||
# # Mimic nixpkgs package environment for read-only profiles.ini management
|
||||
# # From: https://github.com/booxter/home-manager/commit/dd1602e306fec366280f5953c5e1b553e3d9672a
|
||||
# home.sessionVariables = {
|
||||
# MOZ_LEGACY_PROFILES = 1;
|
||||
# MOZ_ALLOW_DOWNGRADE = 1;
|
||||
# };
|
||||
|
||||
# launchd.user.envVariables = config.home-manager.users.${config.user}.home.sessionVariables;
|
||||
|
||||
xdg.mimeApps = {
|
||||
associations.added = {
|
||||
"text/html" = [ "firefox.desktop" ];
|
||||
};
|
||||
defaultApplications = {
|
||||
"text/html" = [ "firefox.desktop" ];
|
||||
};
|
||||
associations.removed = {
|
||||
"text/html" = [ "wine-extension-htm.desktop" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
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"
|
||||
''
|
||||
)
|
||||
}";
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.fish-darwin;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.fish-darwin.enable = lib.mkEnableOption {
|
||||
description = "Fish macOS options";
|
||||
default = config.nmasur.presets.programs.fish && pkgs.stdenv.isDarwin;
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.fish.shellAbbrs = {
|
||||
# Shortcut to edit hosts file
|
||||
hosts = "sudo nvim /etc/hosts";
|
||||
};
|
||||
};
|
||||
}
|
152
platforms/home-manager/modules/nmasur/presets/programs/fish.nix
Normal file
152
platforms/home-manager/modules/nmasur/presets/programs/fish.nix
Normal file
@ -0,0 +1,152 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.fish;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.fish.enable = lib.mkEnableOption "Fish shell";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
|
||||
# Version of bash which works much better on the terminal
|
||||
bash = "${pkgs.bashInteractive}/bin/bash";
|
||||
|
||||
# Use eza (exa) instead of ls for fancier output
|
||||
ls = "${pkgs.eza}/bin/eza --group";
|
||||
|
||||
# Move files to XDG trash on the commandline
|
||||
trash = lib.mkIf pkgs.stdenv.isLinux "${pkgs.trash-cli}/bin/trash-put";
|
||||
};
|
||||
functions = {
|
||||
commandline-git-commits = {
|
||||
description = "Insert commit into commandline";
|
||||
body = builtins.readFile ./functions/commandline-git-commits.fish;
|
||||
};
|
||||
copy = {
|
||||
description = "Copy file contents into clipboard";
|
||||
body = "cat $argv | pbcopy"; # Need to fix for non-macOS
|
||||
};
|
||||
edit = {
|
||||
description = "Open a file in Vim";
|
||||
body = builtins.readFile ./functions/edit.fish;
|
||||
};
|
||||
envs = {
|
||||
description = "Evaluate a bash-like environment variables file";
|
||||
body = ''set -gx (cat $argv | tr "=" " " | string split ' ')'';
|
||||
};
|
||||
fcd = {
|
||||
description = "Jump to directory";
|
||||
argumentNames = "directory";
|
||||
body = builtins.readFile ./functions/fcd.fish;
|
||||
};
|
||||
fish_user_key_bindings = {
|
||||
body = builtins.readFile ./functions/fish_user_key_bindings.fish;
|
||||
};
|
||||
ip = {
|
||||
body = builtins.readFile ./functions/ip.fish;
|
||||
};
|
||||
json = {
|
||||
description = "Tidy up JSON using jq";
|
||||
body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS
|
||||
};
|
||||
note = {
|
||||
description = "Edit or create a note";
|
||||
argumentNames = "filename";
|
||||
body = builtins.readFile ./functions/note.fish;
|
||||
};
|
||||
recent = {
|
||||
description = "Open a recent file in Vim";
|
||||
body = builtins.readFile ./functions/recent.fish;
|
||||
};
|
||||
search-and-edit = {
|
||||
description = "Search and open the relevant file in Vim";
|
||||
body = builtins.readFile ./functions/search-and-edit.fish;
|
||||
};
|
||||
syncnotes = {
|
||||
description = "Full git commit on notes";
|
||||
body = builtins.readFile ./functions/syncnotes.fish;
|
||||
};
|
||||
_which = {
|
||||
description = "Identify the path to a program in the shell";
|
||||
body = "command --search (string sub --start=2 $argv)";
|
||||
};
|
||||
};
|
||||
interactiveShellInit = ''
|
||||
fish_vi_key_bindings
|
||||
bind yy fish_clipboard_copy
|
||||
bind Y fish_clipboard_copy
|
||||
bind -M visual y fish_clipboard_copy
|
||||
bind -M default p fish_clipboard_paste
|
||||
set -g fish_vi_force_cursor
|
||||
set -g fish_cursor_default block
|
||||
set -g fish_cursor_insert line
|
||||
set -g fish_cursor_visual block
|
||||
set -g fish_cursor_replace_one underscore
|
||||
'';
|
||||
loginShellInit = "";
|
||||
shellAbbrs = {
|
||||
|
||||
# Directory aliases
|
||||
l = "ls -lh";
|
||||
lh = "ls -lh";
|
||||
ll = "ls -alhF";
|
||||
la = "ls -a";
|
||||
c = "cd";
|
||||
"-" = "cd -";
|
||||
mkd = "mkdir -pv";
|
||||
|
||||
# Convert a program into its full path
|
||||
"=" = {
|
||||
position = "anywhere";
|
||||
regex = "=\\w+";
|
||||
function = "_which";
|
||||
};
|
||||
|
||||
# System
|
||||
s = "sudo";
|
||||
sc = "systemctl";
|
||||
scs = "systemctl status";
|
||||
sca = "systemctl cat";
|
||||
m = "make";
|
||||
t = "trash";
|
||||
|
||||
# Vim (overwritten by Neovim)
|
||||
v = "vim";
|
||||
vl = "vim -c 'normal! `0'";
|
||||
|
||||
# Notes
|
||||
sn = "syncnotes";
|
||||
|
||||
# Cheat Sheets
|
||||
ssl = "openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
|
||||
fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -";
|
||||
publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub";
|
||||
forloop = "for i in (seq 1 100)";
|
||||
|
||||
# Docker
|
||||
dc = "$DOTS/bin/docker_cleanup";
|
||||
dr = "docker run --rm -it";
|
||||
db = "docker build . -t";
|
||||
};
|
||||
shellInit = "";
|
||||
};
|
||||
|
||||
home.sessionVariables.fish_greeting = "";
|
||||
|
||||
programs.starship.enableFishIntegration = true;
|
||||
programs.zoxide.enableFishIntegration = true;
|
||||
programs.fzf.enableFishIntegration = true;
|
||||
|
||||
};
|
||||
}
|
@ -1,9 +1,19 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.fzf;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
# FZF is a fuzzy-finder for the terminal
|
||||
options.nmasur.presets.programs.fzf.enable = lib.mkEnableOption "Fzf fuzzy finder";
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.fzf.enable = true;
|
||||
|
||||
@ -52,5 +62,6 @@
|
||||
text = builtins.readFile ./bash/scripts/jqr.sh;
|
||||
})
|
||||
];
|
||||
|
||||
};
|
||||
}
|
188
platforms/home-manager/modules/nmasur/presets/programs/git.nix
Normal file
188
platforms/home-manager/modules/nmasur/presets/programs/git.nix
Normal file
@ -0,0 +1,188 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.git;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.git = {
|
||||
enable = lib.mkEnableOption "";
|
||||
gitName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Name to use for git commits";
|
||||
};
|
||||
gitEmail = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Email to use for git commits";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = config.gitName;
|
||||
userEmail = config.gitEmail;
|
||||
extraConfig = {
|
||||
core.pager = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F";
|
||||
interactive.difffilter = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight";
|
||||
pager = {
|
||||
branch = "false";
|
||||
};
|
||||
safe = {
|
||||
directory = config.dotfilesPath;
|
||||
};
|
||||
pull = {
|
||||
ff = "only";
|
||||
};
|
||||
push = {
|
||||
autoSetupRemote = "true";
|
||||
};
|
||||
init = {
|
||||
defaultBranch = "master";
|
||||
};
|
||||
rebase = {
|
||||
autosquash = "true";
|
||||
};
|
||||
gpg = {
|
||||
format = "ssh";
|
||||
ssh.allowedSignersFile = "~/.config/git/allowed-signers";
|
||||
};
|
||||
# commit.gpgsign = true;
|
||||
# tag.gpgsign = true;
|
||||
};
|
||||
ignores = [
|
||||
".direnv/**"
|
||||
"result"
|
||||
];
|
||||
includes = [
|
||||
{
|
||||
path = "~/.config/git/personal";
|
||||
condition = "gitdir:~/dev/personal/";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Personal git config
|
||||
# TODO: fix with variables
|
||||
xdg.configFile."git/personal".text = ''
|
||||
[user]
|
||||
name = "${config.fullName}"
|
||||
email = "7386960+nmasur@users.noreply.github.com"
|
||||
signingkey = ~/.ssh/id_ed25519
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[tag]
|
||||
gpgsign = true
|
||||
'';
|
||||
|
||||
xdg.configFile."git/allowed-signers".text = ''
|
||||
7386960+nmasur@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s
|
||||
'';
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
g = "git";
|
||||
gs = "git status";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gdp = "git diff HEAD^";
|
||||
ga = "git add";
|
||||
gaa = "git add -A";
|
||||
gac = "git commit -am";
|
||||
gc = "git commit -m";
|
||||
gca = "git commit --amend --no-edit";
|
||||
gcae = "git commit --amend";
|
||||
gu = "git pull";
|
||||
gp = "git push";
|
||||
gl = "git log --graph --decorate --oneline -20";
|
||||
gll = "git log --graph --decorate --oneline";
|
||||
gco = "git checkout";
|
||||
gcom = ''git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
|
||||
gcob = "git switch -c";
|
||||
gb = "git branch";
|
||||
gpd = "git push origin -d";
|
||||
gbd = "git branch -d";
|
||||
gbD = "git branch -D";
|
||||
gdd = {
|
||||
position = "anywhere";
|
||||
setCursor = true;
|
||||
expansion = "BRANCH=% git push origin -d $BRANCH and git branch -d $BRANCH";
|
||||
};
|
||||
gr = "git reset";
|
||||
grh = "git reset --hard";
|
||||
gm = "git merge";
|
||||
gcp = "git cherry-pick";
|
||||
cdg = "cd (git rev-parse --show-toplevel)";
|
||||
};
|
||||
|
||||
# Required for fish commands
|
||||
home.packages = with pkgs; [
|
||||
fish
|
||||
fzf
|
||||
bat
|
||||
];
|
||||
|
||||
programs.fish.functions = {
|
||||
git = {
|
||||
body = builtins.readFile ./fish/functions/git.fish;
|
||||
};
|
||||
git-add-fuzzy = {
|
||||
body = builtins.readFile ./fish/functions/git-add-fuzzy.fish;
|
||||
};
|
||||
git-fuzzy-branch = {
|
||||
argumentNames = "header";
|
||||
body = builtins.readFile ./fish/functions/git-fuzzy-branch.fish;
|
||||
};
|
||||
git-checkout-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
'';
|
||||
};
|
||||
git-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-force-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
'';
|
||||
};
|
||||
git-delete-both = {
|
||||
argumentNames = "branch";
|
||||
body = ''
|
||||
git push origin -d $branch
|
||||
git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-merge-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
'';
|
||||
};
|
||||
git-show-fuzzy = {
|
||||
body = builtins.readFile ./fish/functions/git-show-fuzzy.fish;
|
||||
};
|
||||
git-commits = {
|
||||
body = builtins.readFile ./fish/functions/git-commits.fish;
|
||||
};
|
||||
git-history = {
|
||||
body = builtins.readFile ./fish/functions/git-history.fish;
|
||||
};
|
||||
uncommitted = {
|
||||
description = "Find uncommitted git repos";
|
||||
body = builtins.readFile ./fish/functions/uncommitted.fish;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -4,13 +4,18 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.github;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
unfreePackages = [ "gh-copilot" ];
|
||||
options.nmasur.presets.programs.github.enable = lib.mkEnableOption "GitHub features";
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.gh = lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
gitCredentialHelper.enable = true;
|
||||
settings.git_protocol = "https";
|
||||
@ -21,7 +26,7 @@
|
||||
];
|
||||
};
|
||||
|
||||
programs.fish = lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
ghr = "gh repo view -w";
|
||||
gha = "gh run list | head -1 | awk '{ print \\$\\(NF-2\\) }' | xargs gh run view";
|
||||
@ -51,8 +56,6 @@
|
||||
t2) organization="take-two" ;;
|
||||
d2c) organization="take-two-t2gp" ;;
|
||||
t2gp) organization="take-two-t2gp" ;;
|
||||
pd) organization="private-division" ;;
|
||||
dots) organization="playdots" ;;
|
||||
*) organization="nmasur" ;;
|
||||
esac
|
||||
|
||||
@ -85,5 +88,6 @@
|
||||
}
|
||||
'')
|
||||
];
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.himalaya;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.himalaya.enable = lib.mkEnableOption "Himalaya email CLI";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.himalaya = {
|
||||
enable = true;
|
||||
};
|
||||
accounts.email.accounts.home.himalaya = {
|
||||
enable = true;
|
||||
settings = {
|
||||
downloads-dir = config.userDirs.download;
|
||||
smtp-insecure = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
hi = "himalaya";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.jujutsu;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.jujutsu.enable = lib.mkEnableOption "Jujutsu version control";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
|
||||
# https://github.com/martinvonz/jj/blob/main/docs/config.md
|
||||
settings = {
|
||||
user = {
|
||||
name = config.programs.git.userName;
|
||||
email = config.programs.git.userEmail;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
155
platforms/home-manager/modules/nmasur/presets/programs/k9s.nix
Normal file
155
platforms/home-manager/modules/nmasur/presets/programs/k9s.nix
Normal file
@ -0,0 +1,155 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.k9s;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.k9s.enable = lib.mkEnableOption "K9S Kubernetes TUI";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
ks = "k9s";
|
||||
};
|
||||
|
||||
# Terminal Kubernetes UI
|
||||
programs.k9s = {
|
||||
enable = true;
|
||||
settings = {
|
||||
k9s = {
|
||||
ui = {
|
||||
enableMouse = true;
|
||||
headless = true;
|
||||
logoless = true;
|
||||
crumbsless = false;
|
||||
skin = "main";
|
||||
};
|
||||
};
|
||||
};
|
||||
skins = {
|
||||
main = {
|
||||
k9s = {
|
||||
body = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
logoColor = config.theme.colors.base02; # *blue ?
|
||||
};
|
||||
# Search bar
|
||||
prompt = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
suggestColor = config.theme.colors.base03;
|
||||
};
|
||||
# Header left side
|
||||
info = {
|
||||
fgColor = config.theme.colors.base04;
|
||||
sectionColor = config.theme.colors.base05;
|
||||
};
|
||||
dialog = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
buttonFgColor = config.theme.colors.base06;
|
||||
buttonBgColor = config.theme.colors.base0E;
|
||||
buttonFocusFgColor = config.theme.colors.base07;
|
||||
buttonFocusBgColor = config.theme.colors.base02; # *cyan
|
||||
labelFgColor = config.theme.colors.base09;
|
||||
fieldFgColor = config.theme.colors.base06;
|
||||
};
|
||||
frame = {
|
||||
border = {
|
||||
fgColor = config.theme.colors.base01;
|
||||
focusColor = config.theme.colors.base06;
|
||||
};
|
||||
menu = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
keyColor = config.theme.colors.base0E; # *magenta
|
||||
numKeyColor = config.theme.colors.base0E; # *magenta
|
||||
};
|
||||
crumbs = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base01;
|
||||
activeColor = config.theme.colors.base03;
|
||||
};
|
||||
status = {
|
||||
newColor = config.theme.colors.base04; # *cyan
|
||||
modifyColor = config.theme.colors.base0D; # *blue
|
||||
addColor = config.theme.colors.base0B; # *green
|
||||
errorColor = config.theme.colors.base08; # *red
|
||||
highlightColor = config.theme.colors.base09; # *orange
|
||||
killColor = config.theme.colors.base03; # *comment
|
||||
completedColor = config.theme.colors.base03; # *comment
|
||||
};
|
||||
title = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
highlightColor = config.theme.colors.base09; # *orange
|
||||
counterColor = config.theme.colors.base0D; # *blue
|
||||
filterColor = config.theme.colors.base0E; # *magenta
|
||||
};
|
||||
};
|
||||
views = {
|
||||
charts = {
|
||||
bgColor = "default";
|
||||
defaultDialColors = [
|
||||
config.theme.colors.base0D
|
||||
config.theme.colors.base08
|
||||
];
|
||||
# - *blue
|
||||
# - *red
|
||||
defaultChartColors = [
|
||||
config.theme.colors.base0D
|
||||
config.theme.colors.base08
|
||||
];
|
||||
# - *blue
|
||||
# - *red
|
||||
};
|
||||
table = {
|
||||
# List of resources
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
|
||||
# Row selection
|
||||
cursorFgColor = config.theme.colors.base07;
|
||||
cursorBgColor = config.theme.colors.base01;
|
||||
|
||||
# Header row
|
||||
header = {
|
||||
fgColor = config.theme.colors.base0D;
|
||||
bgColor = "default";
|
||||
sorterColor = config.theme.colors.base0A; # *selection
|
||||
};
|
||||
};
|
||||
xray = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
cursorColor = config.theme.colors.base06;
|
||||
graphicColor = config.theme.colors.base0D;
|
||||
showIcons = false;
|
||||
};
|
||||
yaml = {
|
||||
keyColor = config.theme.colors.base0D;
|
||||
colonColor = config.theme.colors.base04;
|
||||
fgColor = config.theme.colors.base03;
|
||||
};
|
||||
logs = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
indicator = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = "default";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
104
platforms/home-manager/modules/nmasur/presets/programs/kitty.nix
Normal file
104
platforms/home-manager/modules/nmasur/presets/programs/kitty.nix
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.kitty;
|
||||
in
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.kitty.enable = lib.mkEnableOption "Kitty terminal";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# Set the i3 terminal
|
||||
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
|
||||
|
||||
# Set the Rofi terminal for running programs
|
||||
programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "${pkgs.kitty}/bin/kitty");
|
||||
|
||||
# Display images in the terminal
|
||||
programs.fish.interactiveShellInit = # fish
|
||||
''
|
||||
if test "$TERM" = "xterm-kitty"
|
||||
alias icat="kitty +kitten icat"
|
||||
alias ssh="kitty +kitten ssh"
|
||||
end
|
||||
'';
|
||||
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
environment = { };
|
||||
extraConfig = "";
|
||||
font.size = 14;
|
||||
keybindings = {
|
||||
# Use shift+enter to complete text suggestions in fish
|
||||
"shift+enter" = "send_text all \\x1F";
|
||||
|
||||
# Easy fullscreen toggle (for macOS)
|
||||
"super+f" = "toggle_fullscreen";
|
||||
};
|
||||
settings = {
|
||||
|
||||
# Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache)
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
selection_background = config.theme.colors.base05;
|
||||
selection_foreground = config.theme.colors.base00;
|
||||
url_color = config.theme.colors.base04;
|
||||
cursor = config.theme.colors.base05;
|
||||
active_border_color = config.theme.colors.base03;
|
||||
inactive_border_color = config.theme.colors.base01;
|
||||
active_tab_background = config.theme.colors.base00;
|
||||
active_tab_foreground = config.theme.colors.base05;
|
||||
inactive_tab_background = config.theme.colors.base01;
|
||||
inactive_tab_foreground = config.theme.colors.base04;
|
||||
tab_bar_background = config.theme.colors.base01;
|
||||
|
||||
# normal
|
||||
color0 = config.theme.colors.base00;
|
||||
color1 = config.theme.colors.base08;
|
||||
color2 = config.theme.colors.base0B;
|
||||
color3 = config.theme.colors.base0A;
|
||||
color4 = config.theme.colors.base0D;
|
||||
color5 = config.theme.colors.base0E;
|
||||
color6 = config.theme.colors.base0C;
|
||||
color7 = config.theme.colors.base05;
|
||||
|
||||
# bright
|
||||
color8 = config.theme.colors.base03;
|
||||
color9 = config.theme.colors.base08;
|
||||
color10 = config.theme.colors.base0B;
|
||||
color11 = config.theme.colors.base0A;
|
||||
color12 = config.theme.colors.base0D;
|
||||
color13 = config.theme.colors.base0E;
|
||||
color14 = config.theme.colors.base0C;
|
||||
color15 = config.theme.colors.base07;
|
||||
|
||||
# extended base16 colors
|
||||
color16 = config.theme.colors.base09;
|
||||
color17 = config.theme.colors.base0F;
|
||||
color18 = config.theme.colors.base01;
|
||||
color19 = config.theme.colors.base02;
|
||||
color20 = config.theme.colors.base04;
|
||||
color21 = config.theme.colors.base06;
|
||||
|
||||
# Scrollback
|
||||
scrollback_lines = 10000;
|
||||
scrollback_pager_history_size = 300; # MB
|
||||
|
||||
# Window
|
||||
window_padding_width = 6;
|
||||
|
||||
tab_bar_edge = "top";
|
||||
tab_bar_style = "slant";
|
||||
|
||||
# Disable audio
|
||||
enable_audio_bell = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.kubectl;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.kubectl.enable = lib.mkEnableOption "Kubernetes CLI tools";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
kubectl # Basic Kubernetes queries
|
||||
kubernetes-helm # Helm CLI
|
||||
fluxcd # Bootstrap clusters with Flux
|
||||
kustomize # Kustomize CLI (for Flux)
|
||||
];
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
k = "kubectl";
|
||||
pods = "kubectl get pods -A";
|
||||
nodes = "kubectl get nodes";
|
||||
deploys = "kubectl get deployments -A";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.alacritty;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.alacritty.enable = lib.mkEnableOption "Alacritty terminal";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Video player
|
||||
programs.mpv = {
|
||||
enable = true;
|
||||
bindings = { };
|
||||
config = {
|
||||
image-display-duration = 2; # For cycling through images
|
||||
hwdec = "auto-safe"; # Attempt to use GPU decoding for video
|
||||
};
|
||||
scripts = [
|
||||
|
||||
# Automatically load playlist entries before and after current file
|
||||
pkgs.mpvScripts.autoload
|
||||
|
||||
# Delete current file after quitting
|
||||
pkgs.mpvScripts.mpv-delete-file
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.nautilus;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.nautilus.enable =
|
||||
lib.mkEnableOption "Nautilus file manager for Linux";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# Quick button for launching nautilus
|
||||
xsession.windowManager.i3.config.keybindings = {
|
||||
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+n" =
|
||||
"exec --no-startup-id ${pkgs.nautilus}/bin/nautilus";
|
||||
};
|
||||
|
||||
# Generates a QR code and previews it with sushi
|
||||
programs.fish.functions = {
|
||||
qr = {
|
||||
body = "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.sushi}/bin/sushi /tmp/qr.png";
|
||||
};
|
||||
};
|
||||
|
||||
# Set Nautilus as default for opening directories
|
||||
xdg.mimeApps = {
|
||||
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
|
||||
defaultApplications."inode/directory" = lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
|
||||
};
|
||||
};
|
||||
}
|
@ -4,9 +4,19 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.nixpkgs-darwin;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
options.nmasur.presets.programs.nixpkgs-darwin.enable = lib.mkEnableOption {
|
||||
description = "Nixpkgs tools for macOS";
|
||||
default = config.nmasur.presets.programs.nixpkgs && pkgs.stdenv.isDarwin;
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.enable) {
|
||||
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
@ -38,5 +48,6 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -4,8 +4,16 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.nixpkgs;
|
||||
in
|
||||
|
||||
{
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
options.nmasur.presets.programs.nixpkgs.enable = lib.mkEnableOption "Nixpkgs presets";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
@ -78,8 +86,8 @@
|
||||
let
|
||||
cacheDir = "${config.homePath}/.cache/nix-index";
|
||||
in
|
||||
lib.mkIf config.home-manager.users.${config.user}.programs.nix-index.enable (
|
||||
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
lib.mkIf config.programs.nix-index.enable (
|
||||
config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -d ${cacheDir} ]; then
|
||||
$DRY_RUN_CMD ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path}
|
||||
fi
|
||||
@ -100,8 +108,8 @@
|
||||
|
||||
# For security, only allow specific users
|
||||
settings.allowed-users = [
|
||||
"@wheel"
|
||||
config.user
|
||||
"@wheel" # Anyone in the wheel group
|
||||
config.user # The current user
|
||||
];
|
||||
|
||||
# Enable features in Nix commands
|
||||
@ -129,5 +137,6 @@
|
||||
# Not working with macOS: https://github.com/NixOS/nix/issues/7273
|
||||
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.noti;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.noti.enable = lib.mkEnableOption "Noti CLI notifications";
|
||||
|
||||
config = lib.mkIf (cfg.enable && (pkgs.stdenv.isDarwin || config.services.dunst.enable)) {
|
||||
home.packages = [ pkgs.noti ];
|
||||
programs.fish.shellAbbrs = {
|
||||
# Add noti for ghpr in Darwin
|
||||
ghpr = lib.mkForce "gh pr create && sleep 3 && noti gh run watch";
|
||||
grw = lib.mkForce "noti gh run watch";
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.nsxiv;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.nsxiv.enable = lib.mkEnableOption "Neo Simple X Image Viewer";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
nsxiv # Image viewer
|
||||
];
|
||||
|
||||
# Set default program for opening images
|
||||
xdg.mimeApps = {
|
||||
associations.added = {
|
||||
"image/jpeg" = [ "nsxiv.desktop" ];
|
||||
"image/png" = [ "nsxiv.desktop" ];
|
||||
"image/*" = [ "nsxiv.desktop" ];
|
||||
};
|
||||
defaultApplications = {
|
||||
"image/jpeg" = [ "nsxiv.desktop" ];
|
||||
"image/png" = [ "nsxiv.desktop" ];
|
||||
"image/*" = [ "nsxiv.desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.prettyping;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.prettyping.enable =
|
||||
lib.mkEnableOption "Prettyping server ping tool";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.fish.functions = {
|
||||
ping = {
|
||||
description = "Improved ping";
|
||||
argumentNames = "target";
|
||||
body = "${pkgs.prettyping}/bin/prettyping --nolegend $target";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.ripgrep;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.ripgrep = {
|
||||
enable = lib.mkEnableOption "Ripgrep search tool";
|
||||
ignorePatterns = ''
|
||||
!.env*
|
||||
!.github/
|
||||
!.gitignore
|
||||
!*.tfvars
|
||||
.terraform/
|
||||
.target/
|
||||
/Library/'';
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ pkgs.ripgrep ];
|
||||
|
||||
home.file = {
|
||||
".rgignore".text = cfg.ignorePatterns;
|
||||
};
|
||||
};
|
||||
}
|
@ -4,9 +4,16 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.starship;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
home-manager.users.${config.user}.programs.starship = {
|
||||
options.nmasur.presets.programs.starship.enable = lib.mkEnableOption "Starship shell prompt";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = false; # Don't print new line at the start of the prompt
|
||||
@ -68,5 +75,6 @@
|
||||
format = "[\${version}\\(\${virtualenv}\\)]($style)";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.weather;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.weather.enable = lib.mkEnableOption "Weather CLI tools";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Used in abbreviations and aliases
|
||||
home.packages = [ pkgs.curl ];
|
||||
programs.fish.shellAbbrs = {
|
||||
|
||||
weather = "curl wttr.in/$WEATHER_CITY";
|
||||
moon = "curl wttr.in/Moon";
|
||||
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,267 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.wezterm;
|
||||
font = config.programs.kitty.font.name;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.wezterm.enable = lib.mkEnableOption "WezTerm terminal";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Set the i3 terminal
|
||||
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "wezterm";
|
||||
|
||||
# Display images in the terminal
|
||||
programs.fish.shellAliases = {
|
||||
icat = lib.mkForce "wezterm imgcat";
|
||||
};
|
||||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
colorSchemes = {
|
||||
myTheme = {
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
cursor_bg = config.theme.colors.base05;
|
||||
cursor_fg = config.theme.colors.base00;
|
||||
cursor_border = config.theme.colors.base05;
|
||||
selection_bg = config.theme.colors.base05;
|
||||
selection_fg = config.theme.colors.base00;
|
||||
scrollbar_thumb = config.theme.colors.base03;
|
||||
ansi = [
|
||||
config.theme.colors.base01 # black
|
||||
config.theme.colors.base0F # maroon
|
||||
config.theme.colors.base0B # green
|
||||
config.theme.colors.base0A # olive
|
||||
config.theme.colors.base0D # navy
|
||||
config.theme.colors.base0E # purple
|
||||
config.theme.colors.base0C # teal
|
||||
config.theme.colors.base06 # silver
|
||||
];
|
||||
brights = [
|
||||
config.theme.colors.base03 # grey
|
||||
config.theme.colors.base08 # red
|
||||
config.theme.colors.base0B # lime
|
||||
config.theme.colors.base0A # yellow
|
||||
config.theme.colors.base0D # blue
|
||||
config.theme.colors.base0E # fuchsia
|
||||
config.theme.colors.base0C # aqua
|
||||
config.theme.colors.base07 # white
|
||||
];
|
||||
compose_cursor = config.theme.colors.base09; # orange
|
||||
copy_mode_active_highlight_bg = {
|
||||
Color = config.theme.colors.base03;
|
||||
};
|
||||
copy_mode_active_highlight_fg = {
|
||||
Color = config.theme.colors.base07;
|
||||
};
|
||||
copy_mode_inactive_highlight_bg = {
|
||||
Color = config.theme.colors.base02;
|
||||
};
|
||||
copy_mode_inactive_highlight_fg = {
|
||||
Color = config.theme.colors.base06;
|
||||
};
|
||||
quick_select_label_bg = {
|
||||
Color = config.theme.colors.base02;
|
||||
};
|
||||
quick_select_label_fg = {
|
||||
Color = config.theme.colors.base06;
|
||||
};
|
||||
quick_select_match_bg = {
|
||||
Color = config.theme.colors.base03;
|
||||
};
|
||||
quick_select_match_fg = {
|
||||
Color = config.theme.colors.base07;
|
||||
};
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
local wezterm = require("wezterm")
|
||||
local config = wezterm.config_builder()
|
||||
config.check_for_updates = false
|
||||
config.color_scheme = "myTheme"
|
||||
|
||||
-- Scrollback
|
||||
config.scrollback_lines = 10000
|
||||
|
||||
-- Window
|
||||
config.window_padding = {
|
||||
left = 10,
|
||||
right = 10,
|
||||
top = 10,
|
||||
bottom = 12,
|
||||
}
|
||||
|
||||
config.font = wezterm.font('${font}', { weight = 'Bold'})
|
||||
config.font_size = ${if pkgs.stdenv.isLinux then "14.0" else "18.0"}
|
||||
|
||||
-- Fix color blocks instead of text
|
||||
config.front_end = "WebGpu"
|
||||
|
||||
-- Tab Bar
|
||||
config.hide_tab_bar_if_only_one_tab = true
|
||||
config.window_frame = {
|
||||
font = wezterm.font('${font}', { weight = 'Bold'}),
|
||||
font_size = ${if pkgs.stdenv.isLinux then "12.0" else "16.0"},
|
||||
}
|
||||
|
||||
config.colors = {
|
||||
tab_bar = {
|
||||
active_tab = {
|
||||
bg_color = '${config.theme.colors.base00}',
|
||||
fg_color = '${config.theme.colors.base04}',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Disable audio
|
||||
config.audible_bell = "Disabled"
|
||||
|
||||
config.initial_rows = 80
|
||||
config.initial_cols = 200
|
||||
|
||||
config.unix_domains = {
|
||||
{
|
||||
name = 'unix',
|
||||
},
|
||||
}
|
||||
|
||||
-- This causes `wezterm` to act as though it was started as
|
||||
-- `wezterm connect unix` by default, connecting to the unix
|
||||
-- domain on startup.
|
||||
-- If you prefer to connect manually, leave out this line.
|
||||
config.default_gui_startup_args = { 'connect', 'unix' }
|
||||
|
||||
config.leader = {
|
||||
key = 'a',
|
||||
mods = 'CTRL',
|
||||
timeout_milliseconds = 2000,
|
||||
}
|
||||
|
||||
config.keys = {
|
||||
-- Attach to muxer
|
||||
{
|
||||
key = 'a',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.AttachDomain 'unix',
|
||||
},
|
||||
|
||||
-- Detach from muxer
|
||||
{
|
||||
key = 'd',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.DetachDomain { DomainName = 'unix' },
|
||||
},
|
||||
-- sends completion string for fish autosuggestions
|
||||
{
|
||||
key = 'Enter',
|
||||
mods = 'SHIFT',
|
||||
action = wezterm.action.SendString '\x1F'
|
||||
},
|
||||
-- ctrl-shift-h was "hide"
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'SHIFT|CTRL',
|
||||
action = wezterm.action.DisableDefaultAssignment
|
||||
},
|
||||
-- alt-enter was "fullscreen"
|
||||
{
|
||||
key = 'Enter',
|
||||
mods = 'ALT',
|
||||
action = wezterm.action.DisableDefaultAssignment
|
||||
},
|
||||
-- make super-f "fullscreen"
|
||||
{
|
||||
key = 'f',
|
||||
mods = 'SUPER',
|
||||
action = wezterm.action.ToggleFullScreen
|
||||
},
|
||||
-- super-t open new tab in new dir
|
||||
{
|
||||
key = 't',
|
||||
mods = ${if pkgs.stdenv.isDarwin then "'SUPER'" else "'ALT'"},
|
||||
action = wezterm.action.SpawnCommandInNewTab {
|
||||
cwd = wezterm.home_dir,
|
||||
},
|
||||
},
|
||||
-- shift-super-t open new tab in same dir
|
||||
{
|
||||
key = 't',
|
||||
mods = 'SUPER|SHIFT',
|
||||
action = wezterm.action.SpawnTab 'CurrentPaneDomain'
|
||||
},
|
||||
-- project switcher
|
||||
{
|
||||
key = 'P',
|
||||
mods = 'SUPER',
|
||||
action = wezterm.action_callback(function(window, pane)
|
||||
local choices = {}
|
||||
|
||||
wezterm.log_info "working?"
|
||||
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
local pfile = popen('${pkgs.fd}/bin/fd --search-path "'..directory..'" --type directory --exact-depth 2 | ${pkgs.proximity-sort}/bin/proximity-sort "'..os.getenv("HOME").."/dev/work"..'"')
|
||||
for filename in pfile:lines() do
|
||||
i = i + 1
|
||||
t[i] = filename
|
||||
end
|
||||
pfile:close()
|
||||
return t
|
||||
end
|
||||
|
||||
for _, v in pairs(scandir(os.getenv("HOME").."/dev")) do
|
||||
table.insert(choices, { label = v })
|
||||
end
|
||||
|
||||
window:perform_action(
|
||||
wezterm.action.InputSelector {
|
||||
action = wezterm.action_callback(function(window, pane, id, label)
|
||||
if not id and not label then
|
||||
wezterm.log_info "cancelled"
|
||||
else
|
||||
window:perform_action(
|
||||
wezterm.action.SpawnCommandInNewTab {
|
||||
cwd = label,
|
||||
},
|
||||
pane
|
||||
)
|
||||
end
|
||||
end),
|
||||
fuzzy = true,
|
||||
title = "Select Project",
|
||||
choices = choices,
|
||||
},
|
||||
pane
|
||||
)
|
||||
end),
|
||||
},
|
||||
}
|
||||
|
||||
-- print the workspace name at the upper right
|
||||
wezterm.on("update-right-status", function(window, pane)
|
||||
window:set_right_status(window:active_workspace())
|
||||
end)
|
||||
-- load plugin
|
||||
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
|
||||
-- set path to zoxide
|
||||
workspace_switcher.zoxide_path = "${pkgs.zoxide}/bin/zoxide"
|
||||
-- keymaps
|
||||
table.insert(config.keys, { key = "s", mods = "CTRL|SHIFT", action = workspace_switcher.switch_workspace() })
|
||||
-- table.insert(config.keys, { key = "t", mods = "CTRL|SHIFT", action = wezterm.action.ShowLauncherArgs({ flags = "FUZZY|WORKSPACES" }) })
|
||||
table.insert(config.keys, { key = "[", mods = "CTRL|SHIFT", action = wezterm.action.SwitchWorkspaceRelative(1) })
|
||||
table.insert(config.keys, { key = "]", mods = "CTRL|SHIFT", action = wezterm.action.SwitchWorkspaceRelative(-1) })
|
||||
|
||||
return config
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.yt-dlp;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.yt-dlp.enable = lib.mkEnableOption "yt-dlp media downloader";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.yt-dlp = {
|
||||
enable = true;
|
||||
extraConfig = "";
|
||||
settings = {
|
||||
no-continue = true; # Always re-download each fragment
|
||||
no-overwrites = true; # Don't overwrite existing files
|
||||
download-archive = "archive.log"; # Log of archives
|
||||
embed-metadata = true;
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "en.*";
|
||||
concurrent-fragments = 4; # Parallel download chunks
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs.yt = "yt-dlp";
|
||||
};
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.zathura;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.zathura.enable = lib.mkEnableOption "Zathura PDF viewer";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
zathura # PDF viewer
|
||||
];
|
||||
# Set default program for opening PDFs
|
||||
xdg.mimeApps = {
|
||||
associations.added = {
|
||||
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||
};
|
||||
associations.removed = {
|
||||
"application/pdf" = [
|
||||
"mupdf.desktop"
|
||||
"wine-extension-pdf.desktop"
|
||||
];
|
||||
};
|
||||
defaultApplications = {
|
||||
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.dunst;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.dunst.enable = lib.mkEnableOption "Dunst notification system";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
enable = false;
|
||||
settings = {
|
||||
global = {
|
||||
width = 300;
|
||||
height = 200;
|
||||
offset = "30x50";
|
||||
origin = "top-right";
|
||||
transparency = 0;
|
||||
padding = 20;
|
||||
horizontal_padding = 20;
|
||||
frame_color = config.theme.colors.base03;
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
background = config.theme.colors.base00;
|
||||
foreground = config.theme.colors.base05;
|
||||
timeout = 10;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.msmtp;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.msmtp.enable = lib.mkEnableOption "System outgoing mail";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.msmtp.enable = true;
|
||||
|
||||
# The system user for sending automatic notifications
|
||||
accounts.email.accounts.system =
|
||||
let
|
||||
address = "system@${config.mail.server}";
|
||||
in
|
||||
{
|
||||
userName = address;
|
||||
realName = "NixOS System";
|
||||
primary = !config.mail.enable; # Only primary if mail not enabled
|
||||
inherit address;
|
||||
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
|
||||
msmtp.enable = true;
|
||||
smtp = {
|
||||
host = config.mail.smtpHost;
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.picom;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.picom.enable = lib.mkEnableOption "Picom compositor";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
services.picom = {
|
||||
enable = true;
|
||||
backend = "glx";
|
||||
settings = {
|
||||
blur = false;
|
||||
blurExclude = [ ];
|
||||
inactiveDim = "0.05";
|
||||
noDNDShadow = false;
|
||||
noDockShadow = false;
|
||||
# shadow-radius = 20
|
||||
# '';
|
||||
# shadow-radius = 20
|
||||
# corner-radius = 10
|
||||
# blur-size = 20
|
||||
# rounded-corners-exclude = [
|
||||
# "window_type = 'dock'",
|
||||
# "class_g = 'i3-frame'"
|
||||
# ]
|
||||
# '';
|
||||
};
|
||||
fade = false;
|
||||
inactiveOpacity = 1.0;
|
||||
menuOpacity = 1.0;
|
||||
opacityRules = [
|
||||
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
|
||||
];
|
||||
shadow = false;
|
||||
shadowExclude = [ ];
|
||||
shadowOffsets = [
|
||||
(-10)
|
||||
(-10)
|
||||
];
|
||||
shadowOpacity = 0.5;
|
||||
vSync = true;
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [
|
||||
{
|
||||
command = "systemctl --user restart picom";
|
||||
always = true;
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.polybar;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.polybar.enable = lib.mkEnableOption "Polybar menu bar";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
services.polybar = {
|
||||
enable = true;
|
||||
package = pkgs.polybar.override {
|
||||
pulseSupport = true;
|
||||
githubSupport = true;
|
||||
i3Support = true;
|
||||
};
|
||||
script = "polybar &";
|
||||
config = {
|
||||
"bar/main" = {
|
||||
bottom = false;
|
||||
width = "100%";
|
||||
height = "22pt";
|
||||
radius = 0;
|
||||
# offset-y = -5;
|
||||
# offset-y = "5%";
|
||||
# dpi = 96;
|
||||
background = config.theme.colors.base01;
|
||||
foreground = config.theme.colors.base05;
|
||||
line-size = "3pt";
|
||||
border-top-size = 0;
|
||||
border-right-size = 0;
|
||||
border-left-size = 0;
|
||||
border-bottom-size = "4pt";
|
||||
border-color = config.theme.colors.base00;
|
||||
padding-left = 2;
|
||||
padding-right = 2;
|
||||
module-margin = 1;
|
||||
modules-left = "i3";
|
||||
modules-center = "xwindow";
|
||||
modules-right = "mailcount network pulseaudio date power";
|
||||
cursor-click = "pointer";
|
||||
cursor-scroll = "ns-resize";
|
||||
enable-ipc = true;
|
||||
tray-position = "right";
|
||||
# wm-restack = "generic";
|
||||
# wm-restack = "bspwm";
|
||||
# wm-restack = "i3";
|
||||
# override-redirect = true;
|
||||
};
|
||||
"module/i3" =
|
||||
let
|
||||
padding = 2;
|
||||
in
|
||||
{
|
||||
type = "internal/i3";
|
||||
pin-workspaces = false;
|
||||
show-urgent = true;
|
||||
strip-wsnumbers = true;
|
||||
index-sort = true;
|
||||
enable-click = true;
|
||||
wrapping-scroll = true;
|
||||
fuzzy-match = true;
|
||||
format = "<label-state> <label-mode>";
|
||||
label-focused = "%name%";
|
||||
label-focused-foreground = config.theme.colors.base01;
|
||||
label-focused-background = config.theme.colors.base05;
|
||||
label-focused-underline = config.theme.colors.base03;
|
||||
label-focused-padding = padding;
|
||||
label-unfocused = "%name%";
|
||||
label-unfocused-padding = padding;
|
||||
label-visible = "%name%";
|
||||
label-visible-underline = config.theme.colors.base01;
|
||||
label-visible-padding = padding;
|
||||
label-urgent = "%name%";
|
||||
label-urgent-foreground = config.theme.colors.base00;
|
||||
label-urgent-background = config.theme.colors.base08;
|
||||
label-urgent-underline = config.theme.colors.base0F;
|
||||
label-urgent-padding = padding;
|
||||
};
|
||||
"module/xworkspaces" = {
|
||||
type = "internal/xworkspaces";
|
||||
label-active = "%name%";
|
||||
label-active-background = config.theme.colors.base05;
|
||||
label-active-foreground = config.theme.colors.base01;
|
||||
label-active-underline = config.theme.colors.base03;
|
||||
label-active-padding = 1;
|
||||
label-occupied = "%name%";
|
||||
label-occupied-padding = 1;
|
||||
label-urgent = "%name%";
|
||||
label-urgent-background = config.theme.colors.base08;
|
||||
label-urgent-padding = 1;
|
||||
label-empty = "%name%";
|
||||
label-empty-foreground = config.theme.colors.base06;
|
||||
label-empty-padding = 1;
|
||||
};
|
||||
"module/xwindow" = {
|
||||
type = "internal/xwindow";
|
||||
label = "%title:0:60:...%";
|
||||
};
|
||||
# "module/filesystem" = {
|
||||
# type = "internal/fs";
|
||||
# interval = 25;
|
||||
# mount-0 = "/";
|
||||
# label-mounted = "%{F#F0C674}%mountpoint%%{F-} %percentage_used%%";
|
||||
# label-unmounted = "%mountpoint% not mounted";
|
||||
# label-unmounted-foreground = colors.disabled;
|
||||
# };
|
||||
"module/mailcount" = {
|
||||
type = "custom/script";
|
||||
interval = 10;
|
||||
format = "<label>";
|
||||
exec = builtins.toString (
|
||||
pkgs.writeShellScript "mailcount.sh" ''
|
||||
${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null
|
||||
UNREAD=$(
|
||||
${pkgs.notmuch}/bin/notmuch count \
|
||||
is:inbox and \
|
||||
is:unread and \
|
||||
folder:main/Inbox \
|
||||
2>/dev/null
|
||||
)
|
||||
if [ $UNREAD = "0" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo "%{T2}%{T-} $UNREAD "
|
||||
fi
|
||||
''
|
||||
);
|
||||
click-left = "i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
|
||||
};
|
||||
"module/network" = {
|
||||
type = "internal/network";
|
||||
interface-type = "wired";
|
||||
interval = 3;
|
||||
accumulate-stats = true;
|
||||
format-connected = "<label-connected>";
|
||||
format-disconnected = "<label-disconnected>";
|
||||
label-connected = "";
|
||||
label-disconnected = "";
|
||||
};
|
||||
"module/pulseaudio" = {
|
||||
type = "internal/pulseaudio";
|
||||
# format-volume-prefix = "VOL ";
|
||||
# format-volume-prefix-foreground = colors.primary;
|
||||
format-volume = "<ramp-volume> <label-volume>";
|
||||
# format-volume-background = colors.background;
|
||||
# label-volume-background = colors.background;
|
||||
format-volume-foreground = config.theme.colors.base04;
|
||||
label-volume = "%percentage%%";
|
||||
label-muted = " ---";
|
||||
label-muted-foreground = config.theme.colors.base03;
|
||||
ramp-volume-0 = "";
|
||||
ramp-volume-1 = "";
|
||||
ramp-volume-2 = "";
|
||||
click-right = config.audioSwitchCommand;
|
||||
};
|
||||
# "module/xkeyboard" = {
|
||||
# type = "internal/xkeyboard";
|
||||
# blacklist-0 = "num lock";
|
||||
# label-layout = "%layout%";
|
||||
# label-layout-foreground = colors.primary;
|
||||
# label-indicator-padding = 2;
|
||||
# label-indicator-margin = 1;
|
||||
# label-indicator-foreground = colors.background;
|
||||
# label-indicator-background = colors.secondary;
|
||||
# };
|
||||
# "module/memory" = {
|
||||
# type = "internal/memory";
|
||||
# interval = 2;
|
||||
# format-prefix = "RAM ";
|
||||
# format-prefix-foreground = colors.primary;
|
||||
# label = "%percentage_used:2%%";
|
||||
# };
|
||||
# "module/cpu" = {
|
||||
# type = "internal/cpu";
|
||||
# interval = 2;
|
||||
# format-prefix = "CPU ";
|
||||
# format-prefix-foreground = colors.primary;
|
||||
# label = "%percentage:2%%";
|
||||
# };
|
||||
# "network-base" = {
|
||||
# type = "internal/network";
|
||||
# interval = 5;
|
||||
# format-connected = "<label-connected>";
|
||||
# format-disconnected = "<label-disconnected>";
|
||||
# label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected";
|
||||
# };
|
||||
# "module/wlan" = {
|
||||
# "inherit" = "network-base";
|
||||
# interface-type = "wireless";
|
||||
# label-connected = "%{F#F0C674}%ifname%%{F-} %essid% %local_ip%";
|
||||
# };
|
||||
# "module/eth" = {
|
||||
# "inherit" = "network-base";
|
||||
# interface-type = "wired";
|
||||
# label-connected = "%{F#F0C674}%ifname%%{F-} %local_ip%";
|
||||
# };
|
||||
"module/date" = {
|
||||
type = "internal/date";
|
||||
interval = 1;
|
||||
date = "%d %b %l:%M %p";
|
||||
date-alt = "%Y-%m-%d %H:%M:%S";
|
||||
label = "%date%";
|
||||
label-foreground = config.theme.colors.base06;
|
||||
# format-background = colors.background;
|
||||
};
|
||||
"module/power" = {
|
||||
type = "custom/text";
|
||||
content = " ";
|
||||
click-left = config.powerCommand;
|
||||
click-right = "polybar-msg cmd restart";
|
||||
content-foreground = config.theme.colors.base04;
|
||||
};
|
||||
"settings" = {
|
||||
screenchange-reload = true;
|
||||
pseudo-transparency = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [
|
||||
{
|
||||
command = "pkill polybar; polybar -r main";
|
||||
always = true;
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.fish;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.fish.enable = lib.mkEnableOption "Fish shell";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.fish.enable = true;
|
||||
|
||||
environment.shells = [ pkgs.fish ];
|
||||
|
||||
users.users.${config.user}.shell = pkgs.fish;
|
||||
|
||||
# Speeds up fish launch time on macOS
|
||||
programs.fish.useBabelfish = true;
|
||||
};
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.homebrew;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.homebrew.enable =
|
||||
lib.mkEnableOption "Homebrew macOS package manager";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Requires Homebrew to be installed
|
||||
system.activationScripts.preUserActivation.text = ''
|
||||
if ! xcode-select --version 2>/dev/null; then
|
||||
$DRY_RUN_CMD xcode-select --install
|
||||
fi
|
||||
if ! /opt/homebrew/bin/brew --version 2>/dev/null; then
|
||||
$DRY_RUN_CMD /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
fi
|
||||
'';
|
||||
|
||||
# Add homebrew paths to CLI path
|
||||
home.sessionPath = [ "/opt/homebrew/bin/" ];
|
||||
|
||||
homebrew = {
|
||||
enable = true;
|
||||
onActivation = {
|
||||
autoUpdate = false; # Don't update during rebuild
|
||||
cleanup = "zap"; # Uninstall all programs not declared
|
||||
upgrade = true;
|
||||
};
|
||||
global = {
|
||||
brewfile = true; # Run brew bundle from anywhere
|
||||
lockfiles = false; # Don't save lockfile (since running from anywhere)
|
||||
};
|
||||
brews = [
|
||||
];
|
||||
casks = [
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.dock;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.dock.enable = lib.mkEnableOption "macOS Dock";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
system.defaults.CustomUserPreferences = {
|
||||
"com.apple.dock" = {
|
||||
magnification = true;
|
||||
largesize = 48;
|
||||
};
|
||||
};
|
||||
|
||||
system.defaults.dock = {
|
||||
|
||||
# Automatically show and hide the dock
|
||||
autohide = true;
|
||||
|
||||
# Add translucency in dock for hidden applications
|
||||
showhidden = true;
|
||||
|
||||
# Enable spring loading on all dock items
|
||||
enable-spring-load-actions-on-all-items = true;
|
||||
|
||||
# Highlight hover effect in dock stack grid view
|
||||
mouse-over-hilite-stack = true;
|
||||
|
||||
mineffect = "genie";
|
||||
orientation = "bottom";
|
||||
show-recents = false;
|
||||
tilesize = 44;
|
||||
|
||||
persistent-apps = [
|
||||
"/Applications/1Password.app"
|
||||
"${pkgs.slack}/Applications/Slack.app"
|
||||
"/System/Applications/Calendar.app"
|
||||
"${pkgs.firefox-bin}/Applications/Firefox.app"
|
||||
"/System/Applications/Messages.app"
|
||||
"/System/Applications/Mail.app"
|
||||
"/Applications/zoom.us.app"
|
||||
"${pkgs.discord}/Applications/Discord.app"
|
||||
"${pkgs.obsidian}/Applications/Obsidian.app"
|
||||
"${pkgs.wezterm}/Applications/WezTerm.app"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.finder;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.finder.enable = lib.mkEnableOption "macOS Finder options";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
system.defaults = {
|
||||
|
||||
finder = {
|
||||
|
||||
# Default Finder window set to column view
|
||||
FXPreferredViewStyle = "clmv";
|
||||
|
||||
# Finder search in current folder by default
|
||||
FXDefaultSearchScope = "SCcf";
|
||||
|
||||
# Disable warning when changing file extension
|
||||
FXEnableExtensionChangeWarning = false;
|
||||
|
||||
# Allow quitting of Finder application
|
||||
QuitMenuItem = true;
|
||||
};
|
||||
|
||||
NSGlobalDomain = {
|
||||
|
||||
# Save to local disk by default, not iCloud
|
||||
NSDocumentSaveNewDocumentsToCloud = false;
|
||||
|
||||
};
|
||||
|
||||
CustomUserPreferences = {
|
||||
|
||||
"com.apple.finder" = {
|
||||
# Disable the warning before emptying the Trash
|
||||
WarnOnEmptyTrash = false;
|
||||
|
||||
# Finder search in current folder by default
|
||||
FXDefaultSearchScope = "SCcf";
|
||||
|
||||
# Default Finder window set to column view
|
||||
FXPreferredViewStyle = "clmv";
|
||||
};
|
||||
# Avoid creating .DS_Store files on network or USB volumes
|
||||
"com.apple.desktopservices" = {
|
||||
DSDontWriteNetworkStores = true;
|
||||
DSDontWriteUSBStores = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# User-level settings
|
||||
activationScripts.postUserActivation.text = ''
|
||||
echo "Show the ~/Library folder"
|
||||
chflags nohidden ~/Library
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.hammerspoon;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.hammerspoon.enable =
|
||||
lib.mkEnableOption "Hammerspoon macOS automation";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua;
|
||||
xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source =
|
||||
./hammerspoon/Spoons/ControlEscape.spoon;
|
||||
xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source =
|
||||
./hammerspoon/Spoons/DismissAlerts.spoon;
|
||||
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = pkgs.substituteAll {
|
||||
src = ./hammerspoon/Spoons/Launcher.spoon/init.lua;
|
||||
firefox = "${pkgs.firefox-bin}/Applications/Firefox.app";
|
||||
discord = "${pkgs.discord}/Applications/Discord.app";
|
||||
wezterm = "${pkgs.wezterm}/Applications/WezTerm.app";
|
||||
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
|
||||
slack = "${pkgs.slack}/Applications/Slack.app";
|
||||
};
|
||||
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./hammerspoon/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()"
|
||||
'';
|
||||
};
|
||||
|
||||
homebrew.casks = [ "hammerspoon" ];
|
||||
|
||||
system.activationScripts.postUserActivation.text = ''
|
||||
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${config.homePath}/.config/hammerspoon/init.lua"
|
||||
sudo killall Dock
|
||||
'';
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.menubar;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.menubar.enable = lib.mkEnableOption "macOS menubar settings";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# User-level settings
|
||||
activationScripts.postUserActivation.text = ''
|
||||
echo "Reduce Menu Bar padding"
|
||||
defaults write -globalDomain NSStatusItemSelectionPadding -int 6
|
||||
defaults write -globalDomain NSStatusItemSpacing -int 6
|
||||
'';
|
||||
|
||||
system.defaults = {
|
||||
|
||||
# Show seconds on the clock
|
||||
menuExtraClock.ShowSeconds = true;
|
||||
|
||||
NSGlobalDomain = {
|
||||
|
||||
# Only hide menu bar in fullscreen
|
||||
_HIHideMenuBar = false;
|
||||
|
||||
};
|
||||
|
||||
CustomUserPreferences = {
|
||||
"leits.MeetingBar" = {
|
||||
eventTimeFormat = ''"show"'';
|
||||
eventTitleFormat = ''"none"'';
|
||||
eventTitleIconFormat = ''"iconCalendar"'';
|
||||
slackBrowser = ''{"deletable":true,"arguments":"","name":"Slack","path":""}'';
|
||||
zoomBrowser = ''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
|
||||
teamsBrowser = ''{"deletable":true,"arguments":"","name":"Teams","path":""}'';
|
||||
KeyboardShortcuts_joinEventShortcut = ''{"carbonModifiers":6400,"carbonKeyCode":38}'';
|
||||
timeFormat = ''"12-hour"'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.nix-daemon;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.nix-daemon.enable = lib.mkEnableOption "Nix garbage collection";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
nix.gc.interval = {
|
||||
Hour = 12;
|
||||
Minute = 15;
|
||||
Day = 1;
|
||||
};
|
||||
};
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.settings;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.settings.enable = lib.mkEnableOption "macOS settings";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
|
||||
system = {
|
||||
|
||||
stateVersion = 5;
|
||||
|
||||
keyboard = {
|
||||
remapCapsLockToControl = true;
|
||||
enableKeyMapping = true; # Allows for skhd
|
||||
};
|
||||
|
||||
defaults = {
|
||||
NSGlobalDomain = {
|
||||
|
||||
# Set to dark mode
|
||||
AppleInterfaceStyle = "Dark";
|
||||
|
||||
# Don't change from dark to light automatically
|
||||
# AppleInterfaceSwitchesAutomatically = false;
|
||||
|
||||
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
|
||||
AppleKeyboardUIMode = 3;
|
||||
|
||||
# Expand save panel by default
|
||||
NSNavPanelExpandedStateForSaveMode = true;
|
||||
|
||||
# Expand print panel by default
|
||||
PMPrintingExpandedStateForPrint = true;
|
||||
|
||||
# Replace press-and-hold with key repeat
|
||||
ApplePressAndHoldEnabled = false;
|
||||
|
||||
# Set a fast key repeat rate
|
||||
KeyRepeat = 2;
|
||||
|
||||
# Shorten delay before key repeat begins
|
||||
InitialKeyRepeat = 12;
|
||||
|
||||
# Disable autocorrect capitalization
|
||||
NSAutomaticCapitalizationEnabled = false;
|
||||
|
||||
# Disable autocorrect smart dashes
|
||||
NSAutomaticDashSubstitutionEnabled = false;
|
||||
|
||||
# Disable autocorrect adding periods
|
||||
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||
|
||||
# Disable autocorrect smart quotation marks
|
||||
NSAutomaticQuoteSubstitutionEnabled = false;
|
||||
|
||||
# Disable autocorrect spellcheck
|
||||
NSAutomaticSpellingCorrectionEnabled = false;
|
||||
};
|
||||
|
||||
# Disable "Are you sure you want to open" dialog
|
||||
LaunchServices.LSQuarantine = false;
|
||||
|
||||
# Disable trackpad tap to click
|
||||
trackpad.Clicking = false;
|
||||
|
||||
# Where to save screenshots
|
||||
screencapture.location = "~/Downloads";
|
||||
|
||||
CustomUserPreferences = {
|
||||
# Disable disk image verification
|
||||
"com.apple.frameworks.diskimages" = {
|
||||
skip-verify = true;
|
||||
skip-verify-locked = true;
|
||||
skip-verify-remote = true;
|
||||
};
|
||||
# Require password immediately after screen saver begins
|
||||
"com.apple.screensaver" = {
|
||||
askForPassword = 1;
|
||||
askForPasswordDelay = 0;
|
||||
};
|
||||
};
|
||||
|
||||
CustomSystemPreferences = {
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
# Settings that don't have an option in nix-darwin
|
||||
activationScripts.postActivation.text = ''
|
||||
echo "Allow apps from anywhere"
|
||||
SPCTL=$(spctl --status)
|
||||
if ! [ "$SPCTL" = "assessments disabled" ]; then
|
||||
sudo spctl --master-disable
|
||||
fi
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.user;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.user.enable = lib.mkEnableOption "macoS user settings";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users."${config.user}" = {
|
||||
# macOS user
|
||||
home = config.homePath;
|
||||
uid = 502;
|
||||
# shell = pkgs.fish; # Default shell
|
||||
};
|
||||
# This might fix the shell issues
|
||||
users.knownUsers = [ config.user ];
|
||||
|
||||
};
|
||||
}
|
33
platforms/nixos/modules/nmasur/presets/programs/calendar.nix
Normal file
33
platforms/nixos/modules/nmasur/presets/programs/calendar.nix
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.calendar;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.calendar.enable = lib.mkEnableOption "Calendar application";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
accounts.calendar.accounts.default = {
|
||||
basePath = "other/calendars"; # Where to save calendars in ~ directory
|
||||
name = "personal";
|
||||
local.type = "filesystem";
|
||||
primary = true;
|
||||
remote = {
|
||||
passwordCommand = [ "" ];
|
||||
type = "caldav";
|
||||
url = "https://${config.hostnames.content}/remote.php/dav/principals/users/${config.user}";
|
||||
userName = config.user;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.gnome-calendar ];
|
||||
};
|
||||
}
|
@ -4,11 +4,16 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.dwarf-fortress;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.gaming.dwarf-fortress.enable = lib.mkEnableOption "Dwarf Fortress free edition.";
|
||||
options.nmasur.presets.programs.dwarf-fortress.enable = lib.mkEnableOption "Dwarf Fortress";
|
||||
|
||||
config = lib.mkIf config.gaming.dwarf-fortress.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
unfreePackages = [
|
||||
"dwarf-fortress"
|
||||
"phoebus-theme"
|
||||
@ -33,5 +38,6 @@
|
||||
dfDesktopItem
|
||||
dtDesktopItem
|
||||
];
|
||||
|
||||
};
|
||||
}
|
24
platforms/nixos/modules/nmasur/presets/programs/nautilus.nix
Normal file
24
platforms/nixos/modules/nmasur/presets/programs/nautilus.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.nautilus;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.nautilus.enable = lib.mkEnableOption "Nautilus file manager";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.nautilus ];
|
||||
|
||||
# Quick preview with spacebar
|
||||
services.gnome.sushi.enable = true;
|
||||
|
||||
};
|
||||
}
|
@ -4,11 +4,16 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.steam;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.gaming.steam.enable = lib.mkEnableOption "Steam game launcher.";
|
||||
options.nmasur.presets.programs.steam.enable = lib.mkEnableOption "Steam game client";
|
||||
|
||||
config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) {
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.steam-hardware.enable = true;
|
||||
unfreePackages = [
|
||||
"steam"
|
||||
@ -38,5 +43,6 @@
|
||||
# Seems like NetworkManager can help speed up Steam launch
|
||||
# https://www.reddit.com/r/archlinux/comments/qguhco/steam_startup_time_arch_1451_seconds_fedora_34/hi8opet/
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
};
|
||||
}
|
18
platforms/nixos/modules/nmasur/presets/programs/template.nix
Normal file
18
platforms/nixos/modules/nmasur/presets/programs/template.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs..enable = lib.mkEnableOption "";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
};
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
|
||||
options = {
|
||||
services.actualbudget = {
|
||||
enable = lib.mkEnableOption "ActualBudget budgeting service";
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
description = "Port to use for the localhost";
|
||||
default = 5006;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.actualbudget.enable {
|
||||
|
||||
virtualisation.podman.enable = lib.mkDefault true;
|
||||
|
||||
users.users.actualbudget = {
|
||||
isSystemUser = true;
|
||||
group = "shared";
|
||||
uid = 980;
|
||||
};
|
||||
|
||||
# Create budget directory, allowing others to manage it
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/actualbudget 0770 actualbudget shared"
|
||||
];
|
||||
|
||||
virtualisation.oci-containers.containers.actualbudget = {
|
||||
workdir = null;
|
||||
volumes = [ "/var/lib/actualbudget:/data" ];
|
||||
user = "${toString (builtins.toString config.users.users.actualbudget.uid)}";
|
||||
pull = "missing";
|
||||
privileged = false;
|
||||
ports = [ "127.0.0.1:${builtins.toString config.services.actualbudget.port}:5006" ];
|
||||
networks = [ ];
|
||||
log-driver = "journald";
|
||||
labels = {
|
||||
app = "actualbudget";
|
||||
};
|
||||
image = "ghcr.io/actualbudget/actual-server:25.1.0";
|
||||
hostname = null;
|
||||
environmentFiles = [ ];
|
||||
environment = {
|
||||
DEBUG = "actual:config"; # Enable debug logging
|
||||
ACTUAL_TRUSTED_PROXIES = builtins.concatStringsSep "," [ "127.0.0.1" ];
|
||||
};
|
||||
dependsOn = [ ];
|
||||
autoStart = true;
|
||||
};
|
||||
|
||||
# Allow web traffic to Caddy
|
||||
caddy.routes = [
|
||||
{
|
||||
match = [ { host = [ config.hostnames.budget ]; } ];
|
||||
handle = [
|
||||
{
|
||||
handler = "reverse_proxy";
|
||||
upstreams = [ { dial = "localhost:${builtins.toString config.services.actualbudget.port}"; } ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
# Configure Cloudflare DNS to point to this machine
|
||||
services.cloudflare-dyndns.domains = [ config.hostnames.budget ];
|
||||
|
||||
# Backups
|
||||
services.restic.backups.default.paths = [ "/var/lib/actualbudget" ];
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
globals,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.audiobookshelf;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.audiobookshelf.enable = lib.mkEnableOption "Audiobookshelf";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
services.audiobookshelf = {
|
||||
enable = true;
|
||||
|
||||
# Setting a generic group to make it easier for the different programs
|
||||
# that make use of the same files
|
||||
group = "shared";
|
||||
|
||||
# This is the default /var/lib/audiobookshelf
|
||||
dataDir = "audiobookshelf";
|
||||
};
|
||||
|
||||
# Allow web traffic to Caddy
|
||||
caddy.routes = [
|
||||
{
|
||||
match = [ { host = [ globals.hostnames.audiobooks ]; } ];
|
||||
handle = [
|
||||
{
|
||||
handler = "reverse_proxy";
|
||||
upstreams = [ { dial = "localhost:${builtins.toString config.services.audiobookshelf.port}"; } ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
# Configure Cloudflare DNS to point to this machine
|
||||
services.cloudflare-dyndns.domains = [ globals.hostnames.audiobooks ];
|
||||
|
||||
};
|
||||
|
||||
}
|
227
platforms/nixos/modules/nmasur/presets/services/caddy.nix
Normal file
227
platforms/nixos/modules/nmasur/presets/services/caddy.nix
Normal file
@ -0,0 +1,227 @@
|
||||
# Caddy is a reverse proxy, like Nginx or Traefik. This creates an ingress
|
||||
# point from my local network or the public (via Cloudflare). Instead of a
|
||||
# Caddyfile, I'm using the more expressive JSON config file format. This means
|
||||
# I can source routes from other areas in my config and build the JSON file
|
||||
# using the result of the expression.
|
||||
|
||||
# Caddy helpfully provides automatic ACME cert generation and management, but
|
||||
# it requires a form of validation. We are using a custom build of Caddy
|
||||
# (compiled with an overlay) to insert a plugin for managing DNS validation
|
||||
# with Cloudflare's DNS API.
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.audiobookshelf;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.caddy = {
|
||||
tlsPolicies = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
description = "Caddy JSON TLS issuer policies";
|
||||
default = [ ];
|
||||
};
|
||||
routes = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
description = "Caddy JSON routes for http servers";
|
||||
default = [ ];
|
||||
};
|
||||
blocks = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
description = "Caddy JSON error blocks for http servers";
|
||||
default = [ ];
|
||||
};
|
||||
cidrAllowlist = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = "CIDR blocks to allow for requests";
|
||||
default = [ ];
|
||||
merge = lib.mkMerge; # Ensure that values are merged from default
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# Force Caddy to 403 if not coming from allowlisted source
|
||||
caddy.cidrAllowlist = lib.mkDefault [ "127.0.0.1/32" ];
|
||||
caddy.routes = lib.mkBefore [
|
||||
{
|
||||
match = [ { not = [ { remote_ip.ranges = config.caddy.cidrAllowlist; } ]; } ];
|
||||
handle = [
|
||||
{
|
||||
handler = "static_response";
|
||||
status_code = "403";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
services.caddy =
|
||||
let
|
||||
default_logger_name = "other";
|
||||
roll_size_mb = 25;
|
||||
# Extract list of hostnames (fqdns) from current caddy routes
|
||||
getHostnameFromMatch = match: if (lib.hasAttr "host" match) then match.host else [ ];
|
||||
getHostnameFromRoute =
|
||||
route:
|
||||
if (lib.hasAttr "match" route) then (lib.concatMap getHostnameFromMatch route.match) else [ ];
|
||||
hostnames_non_unique = lib.concatMap getHostnameFromRoute config.caddy.routes;
|
||||
hostnames = lib.unique hostnames_non_unique;
|
||||
# Create attrset of subdomains to their fqdns
|
||||
hostname_map = builtins.listToAttrs (
|
||||
map (hostname: {
|
||||
name = builtins.head (lib.splitString "." hostname);
|
||||
value = hostname;
|
||||
}) hostnames
|
||||
);
|
||||
in
|
||||
{
|
||||
adapter = "''"; # Required to enable JSON
|
||||
configFile = pkgs.writeText "Caddyfile" (
|
||||
builtins.toJSON {
|
||||
apps.http.servers.main = {
|
||||
listen = [ ":443" ];
|
||||
|
||||
# These routes are pulled from the rest of this repo
|
||||
routes = config.caddy.routes;
|
||||
errors.routes = config.caddy.blocks;
|
||||
|
||||
# Uncommenting collects access logs
|
||||
logs = {
|
||||
inherit default_logger_name;
|
||||
# Invert hostnames keys and values
|
||||
logger_names = lib.mapAttrs' (name: value: {
|
||||
name = value;
|
||||
value = name;
|
||||
}) hostname_map;
|
||||
};
|
||||
};
|
||||
apps.http.servers.metrics = { }; # Enables Prometheus metrics
|
||||
apps.tls.automation.policies = config.caddy.tlsPolicies;
|
||||
|
||||
# Setup logging to journal and files
|
||||
logging.logs =
|
||||
{
|
||||
# System logs and catch-all
|
||||
# Must be called `default` to override Caddy's built-in default logger
|
||||
default = {
|
||||
level = "INFO";
|
||||
encoder.format = "console";
|
||||
writer = {
|
||||
output = "stderr";
|
||||
};
|
||||
exclude = (map (hostname: "http.log.access.${hostname}") (builtins.attrNames hostname_map)) ++ [
|
||||
"http.log.access.${default_logger_name}"
|
||||
];
|
||||
};
|
||||
# This is for the default access logs (anything not captured by hostname)
|
||||
other = {
|
||||
level = "INFO";
|
||||
encoder.format = "json";
|
||||
writer = {
|
||||
output = "file";
|
||||
filename = "${config.services.caddy.logDir}/other.log";
|
||||
roll = true;
|
||||
inherit roll_size_mb;
|
||||
};
|
||||
include = [ "http.log.access.${default_logger_name}" ];
|
||||
};
|
||||
# This is for using the Caddy API, which will probably never happen
|
||||
admin = {
|
||||
level = "INFO";
|
||||
encoder.format = "json";
|
||||
writer = {
|
||||
output = "file";
|
||||
filename = "${config.services.caddy.logDir}/admin.log";
|
||||
roll = true;
|
||||
inherit roll_size_mb;
|
||||
};
|
||||
include = [ "admin" ];
|
||||
};
|
||||
# This is for TLS cert management tracking
|
||||
tls = {
|
||||
level = "INFO";
|
||||
encoder.format = "json";
|
||||
writer = {
|
||||
output = "file";
|
||||
filename = "${config.services.caddy.logDir}/tls.log";
|
||||
roll = true;
|
||||
inherit roll_size_mb;
|
||||
};
|
||||
include = [ "tls" ];
|
||||
};
|
||||
# This is for debugging
|
||||
debug = {
|
||||
level = "DEBUG";
|
||||
encoder.format = "json";
|
||||
writer = {
|
||||
output = "file";
|
||||
filename = "${config.services.caddy.logDir}/debug.log";
|
||||
roll = true;
|
||||
roll_keep = 1;
|
||||
inherit roll_size_mb;
|
||||
};
|
||||
};
|
||||
}
|
||||
# These are the access logs for individual hostnames
|
||||
// (lib.mapAttrs (name: value: {
|
||||
level = "INFO";
|
||||
encoder.format = "json";
|
||||
writer = {
|
||||
output = "file";
|
||||
filename = "${config.services.caddy.logDir}/${name}-access.log";
|
||||
roll = true;
|
||||
inherit roll_size_mb;
|
||||
};
|
||||
include = [ "http.log.access.${name}" ];
|
||||
}) hostname_map)
|
||||
# We also capture just the errors separately for easy debugging
|
||||
// (lib.mapAttrs' (name: value: {
|
||||
name = "${name}-error";
|
||||
value = {
|
||||
level = "ERROR";
|
||||
encoder.format = "json";
|
||||
writer = {
|
||||
output = "file";
|
||||
filename = "${config.services.caddy.logDir}/${name}-error.log";
|
||||
roll = true;
|
||||
inherit roll_size_mb;
|
||||
};
|
||||
include = [ "http.log.access.${name}" ];
|
||||
};
|
||||
}) hostname_map);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
systemd.services.caddy.serviceConfig = {
|
||||
|
||||
# Allows Caddy to serve lower ports (443, 80)
|
||||
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
||||
|
||||
# Prevent flooding of logs by rate-limiting
|
||||
LogRateLimitIntervalSec = "5s"; # Limit period
|
||||
LogRateLimitBurst = 100; # Limit threshold
|
||||
|
||||
};
|
||||
|
||||
# Required for web traffic to reach this machine
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
# HTTP/3 QUIC uses UDP (not sure if being used)
|
||||
networking.firewall.allowedUDPPorts = [ 443 ];
|
||||
|
||||
# Caddy exposes Prometheus metrics with the admin API
|
||||
# https://caddyserver.com/docs/api
|
||||
prometheus.scrapeTargets = [ "127.0.0.1:2019" ];
|
||||
};
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.empty-trash;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.empty-trash.enable = lib.mkEnableOption "automatically empty trash";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# Delete Trash files older than 1 week
|
||||
systemd.user.services.empty-trash = {
|
||||
description = "Empty Trash on a regular basis";
|
||||
wantedBy = [ "default.target" ];
|
||||
script = "${pkgs.trash-cli}/bin/trash-empty 7";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user