move all files to new nixfmt rfc

This commit is contained in:
Noah Masur 2024-04-20 09:42:06 -04:00
parent b23efc4d77
commit e43fc0f8db
No known key found for this signature in database
159 changed files with 5309 additions and 4537 deletions

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: rec { { pkgs, ... }:
rec {
# Show quick helper # Show quick helper
default = import ./help.nix { inherit pkgs; }; default = import ./help.nix { inherit pkgs; };
@ -30,5 +31,4 @@
# Run neovim as an app # Run neovim as an app
neovim = import ./neovim.nix { inherit pkgs; }; neovim = import ./neovim.nix { inherit pkgs; };
nvim = neovim; nvim = neovim;
} }

View File

@ -1,19 +1,19 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age # nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "encrypt-secret" '' program = builtins.toString (
printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2 pkgs.writeShellScript "encrypt-secret" ''
read -p "Secret: " secret printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
printf "\nEncrypting...\n\n" 1>&2 read -p "Secret: " secret
tmpfile=$(mktemp) printf "\nEncrypting...\n\n" 1>&2
echo "''${secret}" > ''${tmpfile} tmpfile=$(mktemp)
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${ echo "''${secret}" > ''${tmpfile}
builtins.toString ../misc/public-keys ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile
} $tmpfile rm $tmpfile
rm $tmpfile ''
''); );
} }

View File

@ -1,39 +1,41 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# This script will partition and format drives; use at your own risk! # This script will partition and format drives; use at your own risk!
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "format-root" '' program = builtins.toString (
set -e pkgs.writeShellScript "format-root" ''
set -e
DISK=$1 DISK=$1
if [ -z "''${DISK}" ]; then if [ -z "''${DISK}" ]; then
${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \ ${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \
--foreground "#fb4934" \ --foreground "#fb4934" \
"Missing required parameter." \ "Missing required parameter." \
"Usage: format-root -- <disk>" \ "Usage: format-root -- <disk>" \
"Flake example: nix run github:nmasur/dotfiles#format-root -- nvme0n1" "Flake example: nix run github:nmasur/dotfiles#format-root -- nvme0n1"
echo "(exiting)" echo "(exiting)"
exit 1 exit 1
fi fi
${pkgs.disko-packaged}/bin/disko \ ${pkgs.disko-packaged}/bin/disko \
--mode create \ --mode create \
--dry-run \ --dry-run \
--flake "path:$(pwd)#root" \ --flake "path:$(pwd)#root" \
--arg disk \""/dev/''${DISK}"\" --arg disk \""/dev/''${DISK}"\"
${pkgs.gum}/bin/gum confirm \ ${pkgs.gum}/bin/gum confirm \
"This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \ "This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \
--default=false --default=false
${pkgs.disko-packaged}/bin/disko \ ${pkgs.disko-packaged}/bin/disko \
--mode create \ --mode create \
--flake "path:$(pwd)#root" \ --flake "path:$(pwd)#root" \
--arg disk "/dev/''${DISK}" --arg disk "/dev/''${DISK}"
'');
''
);
} }

View File

@ -1,23 +1,25 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "default" '' program = builtins.toString (
${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options" pkgs.writeShellScript "default" ''
${pkgs.gum}/bin/gum format --type=template -- ' {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.' ${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options"
echo "" ${pkgs.gum}/bin/gum format --type=template -- ' {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.'
echo "" echo ""
${pkgs.gum}/bin/gum format --type=template -- \ echo ""
' {{ Color "15" "57" " readme " }} {{ Italic "Documentation for this repository." }}' \ ${pkgs.gum}/bin/gum format --type=template -- \
' {{ Color "15" "57" " rebuild " }} {{ Italic "Switch to this configuration." }}' \ ' {{ Color "15" "57" " readme " }} {{ Italic "Documentation for this repository." }}' \
' {{ Color "15" "57" " installer " }} {{ Italic "Format and install from nothing." }}' \ ' {{ Color "15" "57" " rebuild " }} {{ Italic "Switch to this configuration." }}' \
' {{ Color "15" "57" " neovim " }} {{ Italic "Test out the Neovim package." }}' \ ' {{ Color "15" "57" " installer " }} {{ Italic "Format and install from nothing." }}' \
' {{ Color "15" "57" " loadkey " }} {{ Italic "Load an ssh key for this machine using melt." }}' \ ' {{ Color "15" "57" " neovim " }} {{ Italic "Test out the Neovim package." }}' \
' {{ Color "15" "57" " encrypt-secret " }} {{ Italic "Encrypt a secret for all machines." }}' \ ' {{ Color "15" "57" " loadkey " }} {{ Italic "Load an ssh key for this machine using melt." }}' \
' {{ Color "15" "57" " reencrypt-secrets " }} {{ Italic "Reencrypt all secrets when new machine is added." }}' \ ' {{ Color "15" "57" " encrypt-secret " }} {{ Italic "Encrypt a secret for all machines." }}' \
' {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}' ' {{ Color "15" "57" " reencrypt-secrets " }} {{ Italic "Reencrypt all secrets when new machine is added." }}' \
echo "" ' {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}'
echo "" echo ""
''); echo ""
''
);
} }

View File

@ -1,48 +1,50 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix # Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix
# This script will partition and format drives; use at your own risk! # This script will partition and format drives; use at your own risk!
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "installer" '' program = builtins.toString (
set -e pkgs.writeShellScript "installer" ''
set -e
DISK=$1 DISK=$1
FLAKE=$2 FLAKE=$2
PARTITION_PREFIX="" PARTITION_PREFIX=""
if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then
${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \ ${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \
--foreground "#fb4934" \ --foreground "#fb4934" \
"Missing required parameter." \ "Missing required parameter." \
"Usage: installer -- <disk> <host>" \ "Usage: installer -- <disk> <host>" \
"Example: installer -- nvme0n1 tempest" \ "Example: installer -- nvme0n1 tempest" \
"Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest" "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest"
echo "(exiting)" echo "(exiting)"
exit 1 exit 1
fi fi
case "$DISK" in nvme*) case "$DISK" in nvme*)
PARTITION_PREFIX="p" PARTITION_PREFIX="p"
esac esac
${pkgs.gum}/bin/gum confirm \ ${pkgs.gum}/bin/gum confirm \
"This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \ "This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \
--default=false --default=false
${pkgs.parted}/bin/parted /dev/''${DISK} -- mklabel gpt ${pkgs.parted}/bin/parted /dev/''${DISK} -- mklabel gpt
${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart primary 512MiB 100% ${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart primary 512MiB 100%
${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB ${pkgs.parted}/bin/parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB
${pkgs.parted}/bin/parted /dev/''${DISK} -- set 3 esp on ${pkgs.parted}/bin/parted /dev/''${DISK} -- set 3 esp on
mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1 mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1
mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2 mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2
mount /dev/disk/by-label/nixos /mnt mount /dev/disk/by-label/nixos /mnt
mkdir --parents /mnt/boot mkdir --parents /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
'');
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
''
);
} }

View File

@ -1,13 +1,15 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "loadkey" '' program = builtins.toString (
printf "\nEnter the seed phrase for your SSH key...\n" pkgs.writeShellScript "loadkey" ''
printf "\nThen press ^D when complete.\n\n" printf "\nEnter the seed phrase for your SSH key...\n"
mkdir -p ~/.ssh/ printf "\nThen press ^D when complete.\n\n"
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519 mkdir -p ~/.ssh/
printf "\n\nContinuing activation.\n\n" ${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
''); printf "\n\nContinuing activation.\n\n"
''
);
} }

View File

@ -1,12 +1,12 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = "${ program = "${
(import ../modules/common/neovim/package { (import ../modules/common/neovim/package {
inherit pkgs; inherit pkgs;
colors = (import ../colorscheme/nord).dark; colors = (import ../colorscheme/nord).dark;
}) })
}/bin/nvim"; }/bin/nvim";
} }

View File

@ -1,19 +1,21 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "netdata-cloud" '' program = builtins.toString (
if [ "$EUID" -ne 0 ]; then pkgs.writeShellScript "netdata-cloud" ''
echo "Please run as root" if [ "$EUID" -ne 0 ]; then
exit 1 echo "Please run as root"
fi exit 1
mkdir --parents --mode 0750 /var/lib/netdata/cloud.d fi
printf "\nEnter the claim token for netdata cloud...\n\n" mkdir --parents --mode 0750 /var/lib/netdata/cloud.d
read -p "Token: " token printf "\nEnter the claim token for netdata cloud...\n\n"
echo "''${token}" > /var/lib/netdata/cloud.d/token read -p "Token: " token
chown -R netdata:netdata /var/lib/netdata echo "''${token}" > /var/lib/netdata/cloud.d/token
${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen) chown -R netdata:netdata /var/lib/netdata
printf "\n\nNow restart netdata service.\n\n" ${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen)
''); printf "\n\nNow restart netdata service.\n\n"
''
);
} }

View File

@ -1,9 +1,11 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "readme" '' program = builtins.toString (
${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md} pkgs.writeShellScript "readme" ''
''); ${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md}
''
);
} }

View File

@ -1,15 +1,17 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "rebuild" '' program = builtins.toString (
echo ${pkgs.system} pkgs.writeShellScript "rebuild" ''
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"} echo ${pkgs.system}
if [ "$SYSTEM" == "darwin" ]; then SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
sudo darwin-rebuild switch --flake ${builtins.toString ../.} if [ "$SYSTEM" == "darwin" ]; then
else sudo darwin-rebuild switch --flake ${builtins.toString ../.}
doas nixos-rebuild switch --flake ${builtins.toString ../.} else
fi doas nixos-rebuild switch --flake ${builtins.toString ../.}
''); fi
''
);
} }

View File

@ -1,27 +1,27 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# nix run github:nmasur/dotfiles#reencrypt-secrets ./private # nix run github:nmasur/dotfiles#reencrypt-secrets ./private
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "reencrypt-secrets" '' program = builtins.toString (
if [ $# -eq 0 ]; then pkgs.writeShellScript "reencrypt-secrets" ''
echo "Must provide directory to reencrypt." if [ $# -eq 0 ]; then
exit 1 echo "Must provide directory to reencrypt."
fi exit 1
encrypted=$1 fi
for encryptedfile in ''${1}/*; do encrypted=$1
tmpfile=$(mktemp) for encryptedfile in ''${1}/*; do
echo "Decrypting ''${encryptedfile}..." tmpfile=$(mktemp)
${pkgs.age}/bin/age --decrypt \ echo "Decrypting ''${encryptedfile}..."
--identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile ${pkgs.age}/bin/age --decrypt \
echo "Encrypting ''${encryptedfile}..." --identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${ echo "Encrypting ''${encryptedfile}..."
builtins.toString ../misc/public-keys ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile > $encryptedfile
} $tmpfile > $encryptedfile rm $tmpfile
rm $tmpfile done
done echo "Finished."
echo "Finished." ''
''); );
} }

View File

@ -16,9 +16,7 @@
base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted
base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ... base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ...
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
base0E = base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
"#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
base0F =
"#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
}; };
} }

View File

@ -2,8 +2,7 @@
{ {
name = "gruvbox-dark"; # Dark, Medium name = "gruvbox-dark"; # Dark, Medium
author = author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
dark = { dark = {
base00 = "#1D2122"; # ---- This is the change from normal gruvbox base00 = "#1D2122"; # ---- This is the change from normal gruvbox
base01 = "#3c3836"; # --- base01 = "#3c3836"; # ---

View File

@ -1,7 +1,6 @@
{ {
name = "gruvbox"; # Dark, Medium name = "gruvbox"; # Dark, Medium
author = author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
dark = { dark = {
base00 = "#282828"; # ---- base00 = "#282828"; # ----
base01 = "#3c3836"; # --- base01 = "#3c3836"; # ---

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
_1password = { _1password = {
@ -10,9 +16,16 @@
}; };
config = lib.mkIf (config.gui.enable && config._1password.enable) { config = lib.mkIf (config.gui.enable && config._1password.enable) {
unfreePackages = [ "1password" "_1password-gui" "1password-cli" ]; unfreePackages = [
"1password"
"_1password-gui"
"1password-cli"
];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ _1password-gui _1password ]; home.packages = with pkgs; [
_1password-gui
_1password
];
}; };
# https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app # https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app
@ -26,5 +39,4 @@
firefox firefox
''; '';
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
alacritty = { alacritty = {
@ -28,7 +34,9 @@
opacity = 1.0; opacity = 1.0;
}; };
scrolling.history = 10000; scrolling.history = 10000;
font = { size = 14.0; }; font = {
size = 14.0;
};
key_bindings = [ key_bindings = [
# Used for word completion in fish_user_key_bindings # Used for word completion in fish_user_key_bindings
{ {

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./1password.nix ./1password.nix
@ -12,5 +13,4 @@
./slack.nix ./slack.nix
./yt-dlp.nix ./yt-dlp.nix
]; ];
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
discord = { discord = {

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
@ -22,8 +27,7 @@
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = package = if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
profiles.default = { profiles.default = {
id = 0; id = 0;
name = "default"; name = "default";
@ -49,32 +53,24 @@
"app.update.auto" = false; "app.update.auto" = false;
"browser.aboutConfig.showWarning" = false; "browser.aboutConfig.showWarning" = false;
"browser.warnOnQuit" = false; "browser.warnOnQuit" = false;
"browser.quitShortcut.disabled" = "browser.quitShortcut.disabled" = if pkgs.stdenv.isLinux then true else false;
if pkgs.stdenv.isLinux then true else false;
"browser.theme.dark-private-windows" = true; "browser.theme.dark-private-windows" = true;
"browser.toolbars.bookmarks.visibility" = false; "browser.toolbars.bookmarks.visibility" = false;
"browser.startup.page" = 3; # Restore previous session "browser.startup.page" = 3; # Restore previous session
"browser.newtabpage.enabled" = false; # Make new tabs blank "browser.newtabpage.enabled" = false; # Make new tabs blank
"trailhead.firstrun.didSeeAboutWelcome" = "trailhead.firstrun.didSeeAboutWelcome" = true; # Disable welcome splash
true; # Disable welcome splash
"dom.forms.autocomplete.formautofill" = false; # Disable autofill "dom.forms.autocomplete.formautofill" = false; # Disable autofill
"extensions.formautofill.creditCards.enabled" = "extensions.formautofill.creditCards.enabled" = false; # Disable credit cards
false; # Disable credit cards
"dom.payments.defaults.saveAddress" = false; # Disable address save "dom.payments.defaults.saveAddress" = false; # Disable address save
"general.autoScroll" = true; # Drag middle-mouse to scroll "general.autoScroll" = true; # Drag middle-mouse to scroll
"services.sync.prefs.sync.general.autoScroll" = "services.sync.prefs.sync.general.autoScroll" = false; # Prevent disabling autoscroll
false; # Prevent disabling autoscroll
"extensions.pocket.enabled" = false; "extensions.pocket.enabled" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
true; # Allow userChrome.css
"layout.css.color-mix.enabled" = true; "layout.css.color-mix.enabled" = true;
"ui.systemUsesDarkTheme" = "ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
if config.theme.dark == true then 1 else 0; "media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
"media.ffmpeg.vaapi.enabled" =
true; # Enable hardware video acceleration
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups "cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
"devtools.command-button-screenshot.enabled" = "devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page
true; # Scrolling screenshot of entire page
"svg.context-properties.content.enabled" = true; # Sidebery styling "svg.context-properties.content.enabled" = true; # Sidebery styling
}; };
userChrome = '' userChrome = ''
@ -160,33 +156,34 @@
extraConfig = ""; extraConfig = "";
}; };
}; };
xdg.mimeApps = { xdg.mimeApps = {
associations.added = { "text.html" = [ "firefox.desktop" ]; }; associations.added = {
defaultApplications = { "text.html" = [ "firefox.desktop" ]; }; "text.html" = [ "firefox.desktop" ];
};
defaultApplications = {
"text.html" = [ "firefox.desktop" ];
};
}; };
xsession.windowManager.i3.config.keybindings = xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
lib.mkIf pkgs.stdenv.isLinux { "${
"${ config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier }+Shift+b" = "exec ${
}+Shift+b" = "exec ${ # Don't name the script `firefox` or it will affect grep
# Don't name the script `firefox` or it will affect grep builtins.toString (
builtins.toString (pkgs.writeShellScript "focus-ff.sh" '' pkgs.writeShellScript "focus-ff.sh" ''
count=$(ps aux | grep -c firefox) count=$(ps aux | grep -c firefox)
if [ "$count" -eq 1 ]; then if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id firefox" i3-msg "exec --no-startup-id firefox"
sleep 0.5 sleep 0.5
fi fi
i3-msg "[class=firefox] focus" i3-msg "[class=firefox] focus"
'') ''
}"; )
}; }";
};
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
kitty = { kitty = {
@ -13,20 +19,19 @@
# Set the Rofi-Systemd terminal for viewing logs # Set the Rofi-Systemd terminal for viewing logs
# Using optionalAttrs because only available in NixOS # Using optionalAttrs because only available in NixOS
environment = { } // lib.attrsets.optionalAttrs environment =
(builtins.hasAttr "sessionVariables" config.environment) { { }
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty"; sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Set the i3 terminal # Set the i3 terminal
xsession.windowManager.i3.config.terminal = xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
lib.mkIf pkgs.stdenv.isLinux "kitty";
# Set the Rofi terminal for running programs # Set the Rofi terminal for running programs
programs.rofi.terminal = programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
# Display images in the terminal # Display images in the terminal
programs.fish.shellAliases = { programs.fish.shellAliases = {
@ -48,16 +53,14 @@
# Kitty scrollback nvim # Kitty scrollback nvim
"kitty_mod+h" = "kitty_scrollback_nvim"; "kitty_mod+h" = "kitty_scrollback_nvim";
"kitty_mod+g" = "kitty_mod+g" = "kitty_scrollback_nvim --config ksb_builtin_last_cmd_output";
"kitty_scrollback_nvim --config ksb_builtin_last_cmd_output";
}; };
settings = { settings = {
# Required for kitty-scrollback.nvim # Required for kitty-scrollback.nvim
allow_remote_control = "socket-only"; allow_remote_control = "socket-only";
listen_on = "unix:/tmp/kitty"; listen_on = "unix:/tmp/kitty";
action_alias = action_alias = "kitty_scrollback_nvim kitten ${pkgs.vimPlugins.kitty-scrollback-nvim}/python/kitty_scrollback_nvim.py";
"kitty_scrollback_nvim kitten ${pkgs.vimPlugins.kitty-scrollback-nvim}/python/kitty_scrollback_nvim.py";
# Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache) # Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache)
background = config.theme.colors.base00; background = config.theme.colors.base00;

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
media = { media = {
@ -44,7 +50,10 @@
"image/*" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ];
}; };
associations.removed = { associations.removed = {
"application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ]; "application/pdf" = [
"mupdf.desktop"
"wine-extension-pdf.desktop"
];
}; };
defaultApplications = { defaultApplications = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
@ -53,9 +62,6 @@
"image/*" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ];
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
obsidian = { obsidian = {
@ -18,7 +24,5 @@
# Broken on 2023-12-11 # Broken on 2023-12-11
# https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8 # https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8
nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
qbittorrent = { qbittorrent = {
@ -14,8 +20,6 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ qbittorrent ]; home.packages = with pkgs; [ qbittorrent ];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
slack = { slack = {
@ -15,5 +21,4 @@
home.packages = with pkgs; [ slack ]; home.packages = with pkgs; [ slack ];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
yt-dlp = { yt-dlp = {
@ -27,9 +33,6 @@
}; };
programs.fish.shellAbbrs.yt = "yt-dlp"; programs.fish.shellAbbrs.yt = "yt-dlp";
}; };
}; };
} }

View File

@ -1,7 +1,19 @@
{ config, lib, pkgs, ... }: { {
config,
lib,
pkgs,
...
}:
{
imports = imports = [
[ ./applications ./mail ./neovim ./programming ./repositories ./shell ]; ./applications
./mail
./neovim
./programming
./repositories
./shell
];
options = { options = {
user = lib.mkOption { user = lib.mkOption {
@ -17,8 +29,7 @@
download = lib.mkOption { download = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "XDG directory for downloads"; description = "XDG directory for downloads";
default = default = if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
}; };
}; };
identityFile = lib.mkOption { identityFile = lib.mkOption {
@ -47,10 +58,9 @@
homePath = lib.mkOption { homePath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "Path of user's home directory."; description = "Path of user's home directory.";
default = builtins.toPath (if pkgs.stdenv.isDarwin then default = builtins.toPath (
"/Users/${config.user}" if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
else );
"/home/${config.user}");
}; };
dotfilesPath = lib.mkOption { dotfilesPath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
@ -122,28 +132,33 @@
}; };
}; };
config = let stateVersion = "23.05"; config =
in { let
stateVersion = "23.05";
in
{
# Basic common system packages for all devices # Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ]; environment.systemPackages = with pkgs; [
git
vim
wget
curl
];
# Use the system-level nixpkgs instead of Home Manager's # Use the system-level nixpkgs instead of Home Manager's
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when # Install packages to /etc/profiles instead of ~/.nix-profile, useful when
# using multiple profiles for one user # using multiple profiles for one user
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
# Allow specified unfree packages (identified elsewhere) # Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name # Retrieves package object based on string name
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.unfreePackages;
builtins.elem (lib.getName pkg) config.unfreePackages;
# Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion;
};
# Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion;
};
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.mail.aerc.enable = lib.mkEnableOption "Aerc email."; options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
@ -75,7 +81,9 @@
"<Esc>" = ":clear<Enter>"; "<Esc>" = ":clear<Enter>";
}; };
"messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; }; "messages:folder=Drafts" = {
"<Enter>" = ":recall<Enter>";
};
view = { view = {
"/" = ":toggle-key-passthrough <Enter> /"; "/" = ":toggle-key-passthrough <Enter> /";
@ -148,21 +156,19 @@
"<C-p>" = ":prev-tab<Enter>"; "<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>"; "<C-n>" = ":next-tab<Enter>";
}; };
}; };
extraConfig = { extraConfig = {
general.unsafe-accounts-conf = true; general.unsafe-accounts-conf = true;
viewer = { pager = "${pkgs.less}/bin/less -R"; }; viewer = {
pager = "${pkgs.less}/bin/less -R";
};
filters = { filters = {
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize"; "text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"text/calendar" = "text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/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/html" =
"${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
# "text/*" = # "text/*" =
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "''; # ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
"message/delivery-status" = "message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"${pkgs.aerc}/libexec/aerc/filters/colorize";
"message/rfc822" = "${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/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
"application/pdf" = "${pkgs.zathura}/bin/zathura -"; "application/pdf" = "${pkgs.zathura}/bin/zathura -";
@ -184,26 +190,27 @@
name = "aerc"; name = "aerc";
exec = "kitty aerc %u"; exec = "kitty aerc %u";
}; };
xsession.windowManager.i3.config.keybindings = xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
lib.mkIf pkgs.stdenv.isLinux { "${
"${ config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier }+Shift+e" = "exec ${
}+Shift+e" = "exec ${ # Don't name the script `aerc` or it will affect grep
# Don't name the script `aerc` or it will affect grep builtins.toString (
builtins.toString (pkgs.writeShellScript "focus-mail.sh" '' pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc) count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id kitty --class aerc aerc" i3-msg "exec --no-startup-id kitty --class aerc aerc"
sleep 0.25 sleep 0.25
fi fi
i3-msg "[class=aerc] focus" i3-msg "[class=aerc] focus"
'') ''
}"; )
}; }";
};
programs.fish.shellAbbrs = { ae = "aerc"; };
programs.fish.shellAbbrs = {
ae = "aerc";
};
}; };
}; };
} }

View File

@ -1,6 +1,16 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
imports = [ ./himalaya.nix ./aerc.nix ./system.nix ]; imports = [
./himalaya.nix
./aerc.nix
./system.nix
];
options = { options = {
mail.enable = lib.mkEnableOption "Mail service."; mail.enable = lib.mkEnableOption "Mail service.";
@ -26,7 +36,9 @@
config = lib.mkIf config.mail.enable { config = lib.mkIf config.mail.enable {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.mbsync = { enable = true; }; programs.mbsync = {
enable = true;
};
# Automatically check for mail and keep files synced locally # Automatically check for mail and keep files synced locally
services.mbsync = lib.mkIf pkgs.stdenv.isLinux { services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
@ -44,8 +56,11 @@
# Better local mail search # Better local mail search
programs.notmuch = { programs.notmuch = {
enable = true; enable = true;
new.ignore = new.ignore = [
[ ".mbsyncstate.lock" ".mbsyncstate.journal" ".mbsyncstate.new" ]; ".mbsyncstate.lock"
".mbsyncstate.journal"
".mbsyncstate.new"
];
}; };
accounts.email = { accounts.email = {
@ -54,72 +69,71 @@
maildirBasePath = "${config.homePath}/mail"; maildirBasePath = "${config.homePath}/mail";
accounts = { accounts = {
home = let address = "${config.mail.user}@${config.mail.server}"; home =
in { let
userName = address; address = "${config.mail.user}@${config.mail.server}";
realName = config.fullName; in
primary = true; {
inherit address; userName = address;
aliases = map (user: "${user}@${config.mail.server}") [ realName = config.fullName;
"me" primary = true;
"hey" inherit address;
"admin" aliases = map (user: "${user}@${config.mail.server}") [
]; "me"
"hey"
"admin"
];
# Options for contact completion # Options for contact completion
alot = { }; alot = { };
imap = { imap = {
host = config.mail.imapHost; host = config.mail.imapHost;
port = 993; port = 993;
tls.enable = true; tls.enable = true;
}; };
# Watch for mail and run notifications or sync # Watch for mail and run notifications or sync
imapnotify = { imapnotify = {
enable = true; enable = true;
boxes = [ "Inbox" ]; boxes = [ "Inbox" ];
onNotify = "${pkgs.isync}/bin/mbsync -a"; onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost = lib.mkIf onNotifyPost =
config.home-manager.users.${config.user}.services.dunst.enable lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; "${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
}; };
# Name of the directory in maildir for this account # Name of the directory in maildir for this account
maildir = { path = "main"; }; maildir = {
path = "main";
};
# Bi-directional syncing options for local files # Bi-directional syncing options for local files
mbsync = { mbsync = {
enable = true; enable = true;
create = "both"; create = "both";
expunge = "both"; expunge = "both";
remove = "both"; remove = "both";
patterns = [ "*" ]; patterns = [ "*" ];
extraConfig.channel = { extraConfig.channel = {
CopyArrivalDate = "yes"; # Sync time of original message 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;
}; };
}; };
# 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;
};
};
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, lib, ... }: { { config, lib, ... }:
{
options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email."; options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
@ -6,7 +7,9 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.himalaya = { enable = true; }; programs.himalaya = {
enable = true;
};
accounts.email.accounts.home.himalaya = { accounts.email.accounts.home.himalaya = {
enable = true; enable = true;
settings = { settings = {
@ -15,9 +18,9 @@
}; };
}; };
programs.fish.shellAbbrs = { hi = "himalaya"; }; programs.fish.shellAbbrs = {
hi = "himalaya";
};
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (config.mail.enable || config.server) { config = lib.mkIf (config.mail.enable || config.server) {
@ -8,17 +14,15 @@
# The system user for sending automatic notifications # The system user for sending automatic notifications
accounts.email.accounts.system = accounts.email.accounts.system =
let address = "system@${config.mail.server}"; let
in { address = "system@${config.mail.server}";
in
{
userName = address; userName = address;
realName = "NixOS System"; realName = "NixOS System";
primary = !config.mail.enable; # Only primary if mail not enabled primary = !config.mail.enable; # Only primary if mail not enabled
inherit address; inherit address;
passwordCommand = passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
pkgs.writeText "mailpass-system.age"
(builtins.readFile ../../../private/mailpass-system.age)
}";
msmtp.enable = true; msmtp.enable = true;
smtp = { smtp = {
host = config.mail.smtpHost; host = config.mail.smtpHost;
@ -26,9 +30,6 @@
tls.enable = true; tls.enable = true;
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Plugin for aligning text programmatically # Plugin for aligning text programmatically

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Shows buffers in a VSCode-style tab layout # Shows buffers in a VSCode-style tab layout
@ -11,7 +12,7 @@
diagnostics = "nvim_lsp"; diagnostics = "nvim_lsp";
always_show_bufferline = false; always_show_bufferline = false;
separator_style = "slant"; separator_style = "slant";
offsets = [{ filetype = "NvimTree"; }]; offsets = [ { filetype = "NvimTree"; } ];
}; };
}; };
lua = '' lua = ''

View File

@ -1,4 +1,10 @@
{ pkgs, lib, config, ... }: { {
pkgs,
lib,
config,
...
}:
{
# Sets Neovim colors based on Nix colorscheme # Sets Neovim colors based on Nix colorscheme
@ -18,5 +24,4 @@
} }
''; '';
}; };
} }

View File

@ -1,4 +1,5 @@
{ pkgs, dsl, ... }: { { pkgs, dsl, ... }:
{
plugins = [ plugins = [
pkgs.vimPlugins.cmp-nvim-lsp pkgs.vimPlugins.cmp-nvim-lsp
@ -25,21 +26,15 @@
# Basic completion keybinds # Basic completion keybinds
mapping = { mapping = {
"['<C-n>']" = dsl.rawLua "['<C-n>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })"; "['<C-p>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
"['<C-p>']" = dsl.rawLua "['<Down>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })"; "['<Up>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
"['<Down>']" = dsl.rawLua
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
"['<Up>']" = dsl.rawLua
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)"; "['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)"; "['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()"; "['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
"['<CR>']" = dsl.rawLua "['<CR>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })"; "['<C-r>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
"['<C-r>']" = dsl.rawLua
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
"['<Esc>']" = dsl.rawLua '' "['<Esc>']" = dsl.rawLua ''
function(_) function(_)
cmp.mapping({ cmp.mapping({
@ -72,13 +67,19 @@
name = "rg"; # Grep for text from the current directory name = "rg"; # Grep for text from the current directory
keyword_length = 6; keyword_length = 6;
max_item_count = 10; max_item_count = 10;
option = { additional_arguments = "--ignore-case"; }; option = {
additional_arguments = "--ignore-case";
};
} }
]; ];
# Styling of the completion menu # Styling of the completion menu
formatting = { formatting = {
fields = [ "kind" "abbr" "menu" ]; fields = [
"kind"
"abbr"
"menu"
];
format = dsl.rawLua '' format = dsl.rawLua ''
function(entry, vim_item) function(entry, vim_item)
local kind_icons = { local kind_icons = {
@ -125,7 +126,6 @@
native_menu = false; # Use cmp menu instead of Vim menu native_menu = false; # Use cmp menu instead of Vim menu
ghost_text = true; # Show preview auto-completion ghost_text = true; # Show preview auto-completion
}; };
}; };
lua = '' lua = ''
@ -145,5 +145,4 @@
}), }),
}) })
''; '';
} }

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
plugins = [ pkgs.vimPlugins.gitsigns-nvim ]; plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
setup.gitsigns = { }; setup.gitsigns = { };
lua = builtins.readFile ./gitsigns.lua; lua = builtins.readFile ./gitsigns.lua;

View File

@ -1,4 +1,10 @@
{ pkgs, dsl, lib, ... }: { {
pkgs,
dsl,
lib,
...
}:
{
plugins = [ plugins = [
pkgs.vimPlugins.vim-surround # Keybinds for surround characters pkgs.vimPlugins.vim-surround # Keybinds for surround characters
pkgs.vimPlugins.vim-eunuch # File manipulation commands pkgs.vimPlugins.vim-eunuch # File manipulation commands
@ -13,7 +19,11 @@
# Initialize some plugins # Initialize some plugins
setup.Comment = { }; setup.Comment = { };
setup.colorizer = { user_default_options = { names = false; }; }; setup.colorizer = {
user_default_options = {
names = false;
};
};
setup.glow = { }; setup.glow = { };
setup.which-key = { }; setup.which-key = { };
setup.kitty-scrollback = { }; setup.kitty-scrollback = { };
@ -54,12 +64,15 @@
vim.o.backup = true; # Easier to recover and more secure vim.o.backup = true; # Easier to recover and more secure
vim.bo.swapfile = false; # Instead of swaps, create backups vim.bo.swapfile = false; # Instead of swaps, create backups
vim.bo.undofile = true; # Keeps undos after quit vim.bo.undofile = true; # Keeps undos after quit
vim.o.backupdir = vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")''; vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
# Required for nvim-cmp completion # Required for nvim-cmp completion
vim.opt.completeopt = [ "menu" "menuone" "noselect" ]; vim.opt.completeopt = [
"menu"
"menuone"
"noselect"
];
lua = lib.mkBefore '' lua = lib.mkBefore ''
vim.loader.enable() vim.loader.enable()

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
plugins = [ pkgs.vimPlugins.lualine-nvim ]; plugins = [ pkgs.vimPlugins.lualine-nvim ];
setup.lualine = { setup.lualine = {
options = { options = {

View File

@ -1,8 +1,9 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }:
{
plugins = [ plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins: (pkgs.vimPlugins.nvim-treesitter.withPlugins (
with pkgs.tree-sitter-grammars; [ _plugins: with pkgs.tree-sitter-grammars; [
tree-sitter-bash tree-sitter-bash
tree-sitter-c tree-sitter-c
tree-sitter-fish tree-sitter-fish
@ -19,7 +20,8 @@
tree-sitter-toml tree-sitter-toml
tree-sitter-vimdoc tree-sitter-vimdoc
tree-sitter-yaml tree-sitter-yaml
])) ]
))
pkgs.vimPlugins.vim-matchup # Better % jumping in languages pkgs.vimPlugins.vim-matchup # Better % jumping in languages
pkgs.vimPlugins.playground # Tree-sitter experimenting pkgs.vimPlugins.playground # Tree-sitter experimenting
pkgs.vimPlugins.nginx-vim pkgs.vimPlugins.nginx-vim
@ -34,9 +36,15 @@
]; ];
setup."nvim-treesitter.configs" = { setup."nvim-treesitter.configs" = {
highlight = { enable = true; }; highlight = {
indent = { enable = true; }; enable = true;
matchup = { enable = true; }; # Uses vim-matchup };
indent = {
enable = true;
};
matchup = {
enable = true;
}; # Uses vim-matchup
textobjects = { textobjects = {
select = { select = {
@ -70,5 +78,4 @@
-- Use HCL parser with .tf files -- Use HCL parser with .tf files
vim.treesitter.language.register('hcl', 'terraform') vim.treesitter.language.register('hcl', 'terraform')
''; '';
} }

View File

@ -1,4 +1,5 @@
{ pkgs, dsl, ... }: { { pkgs, dsl, ... }:
{
# Telescope is a fuzzy finder that can work with different sub-plugins # Telescope is a fuzzy finder that can work with different sub-plugins
@ -20,9 +21,15 @@
}; };
}; };
pickers = { pickers = {
find_files = { theme = "ivy"; }; find_files = {
oldfiles = { theme = "ivy"; }; theme = "ivy";
buffers = { theme = "dropdown"; }; };
oldfiles = {
theme = "ivy";
};
buffers = {
theme = "dropdown";
};
}; };
extensions = { extensions = {
fzy_native = { }; fzy_native = { };
@ -33,5 +40,4 @@
setup.project_nvim = { }; setup.project_nvim = { };
lua = builtins.readFile ./telescope.lua; lua = builtins.readFile ./telescope.lua;
} }

View File

@ -1,4 +1,10 @@
{ pkgs, dsl, config, ... }: { {
pkgs,
dsl,
config,
...
}:
{
# Toggleterm provides a floating terminal inside the editor for quick access # Toggleterm provides a floating terminal inside the editor for quick access
@ -15,5 +21,4 @@
${if config.github then (builtins.readFile ./github.lua) else ""} ${if config.github then (builtins.readFile ./github.lua) else ""}
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""} ${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
''; '';
} }

View File

@ -1,8 +1,12 @@
{ pkgs, dsl, ... }: { { pkgs, dsl, ... }:
{
# This plugin creates a side drawer for navigating the current project # This plugin creates a side drawer for navigating the current project
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ]; plugins = [
pkgs.vimPlugins.nvim-tree-lua
pkgs.vimPlugins.nvim-web-devicons
];
# Disable netrw eagerly # Disable netrw eagerly
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129 # https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
@ -16,12 +20,14 @@
hijack_netrw = true; # Works as the file manager hijack_netrw = true; # Works as the file manager
sync_root_with_cwd = true; # Change project whenever currend dir changes sync_root_with_cwd = true; # Change project whenever currend dir changes
respect_buf_cwd = true; # Change to exact location of focused buffer respect_buf_cwd = true; # Change to exact location of focused buffer
update_focused_file = { # Change project based on the focused buffer update_focused_file = {
# Change project based on the focused buffer
enable = true; enable = true;
update_root = true; update_root = true;
ignore_list = { }; ignore_list = { };
}; };
diagnostics = { # Enable LSP and linter integration diagnostics = {
# Enable LSP and linter integration
enable = true; enable = true;
icons = { icons = {
hint = ""; hint = "";
@ -30,7 +36,8 @@
error = ""; error = "";
}; };
}; };
renderer = { # Show files with changes vs. current commit renderer = {
# Show files with changes vs. current commit
icons = { icons = {
glyphs = { glyphs = {
git = { git = {
@ -61,7 +68,8 @@
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split')) vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
end end
''; '';
view = { # Set look and feel view = {
# Set look and feel
width = 30; width = 30;
side = "left"; side = "left";
number = false; number = false;
@ -73,5 +81,4 @@
lua = '' lua = ''
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true }) vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
''; '';
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
@ -9,8 +14,8 @@ let
github = true; github = true;
kubernetes = config.kubernetes.enable; kubernetes = config.kubernetes.enable;
}; };
in
in { {
options.neovim.enable = lib.mkEnableOption "Neovim."; options.neovim.enable = lib.mkEnableOption "Neovim.";
@ -33,7 +38,9 @@ in {
# Create quick aliases for launching Neovim # Create quick aliases for launching Neovim
programs.fish = { programs.fish = {
shellAliases = { vim = "nvim"; }; shellAliases = {
vim = "nvim";
};
shellAbbrs = { shellAbbrs = {
v = lib.mkForce "nvim"; v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'"; vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
@ -45,23 +52,22 @@ in {
# Requires removing some of the ANSI escape codes that are sent to the # Requires removing some of the ANSI escape codes that are sent to the
# scrollback using sed and baleia, as well as removing several # scrollback using sed and baleia, as well as removing several
# unnecessary features. # unnecessary features.
programs.kitty.settings.scrollback_pager = programs.kitty.settings.scrollback_pager = "${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1";
"${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1";
# Create a desktop option for launching Neovim from a file manager # Create a desktop option for launching Neovim from a file manager
# (Requires launching the terminal and then executing Neovim) # (Requires launching the terminal and then executing Neovim)
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux { xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
name = "Neovim wrapper"; name = "Neovim wrapper";
exec = "kitty nvim %F"; exec = "kitty nvim %F";
mimeType = [ "text/plain" "text/markdown" ]; mimeType = [
"text/plain"
"text/markdown"
];
}; };
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux { xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
"text/plain" = [ "nvim.desktop" ]; "text/plain" = [ "nvim.desktop" ];
"text/markdown" = [ "nvim.desktop" ]; "text/markdown" = [ "nvim.desktop" ];
}; };
}; };
}; };
} }

View File

@ -26,13 +26,25 @@
# ] ++ extraConfig; # ] ++ extraConfig;
# } # }
{ pkgs, colors, terraform ? false, github ? false, kubernetes ? false, ... }: {
pkgs,
colors,
terraform ? false,
github ? false,
kubernetes ? false,
...
}:
# Comes from nix2vim overlay: # Comes from nix2vim overlay:
# https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix # https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix
pkgs.neovimBuilder { pkgs.neovimBuilder {
package = pkgs.neovim-unwrapped; package = pkgs.neovim-unwrapped;
inherit colors terraform github kubernetes; inherit
colors
terraform
github
kubernetes
;
imports = [ imports = [
../config/align.nix ../config/align.nix
../config/bufferline.nix ../config/bufferline.nix

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./haskell.nix ./haskell.nix
@ -9,5 +10,4 @@
./rust.nix ./rust.nix
./terraform.nix ./terraform.nix
]; ];
} }

View File

@ -1,14 +1,12 @@
{ config, lib, ... }: { { config, lib, ... }:
{
options.haskell.enable = lib.mkEnableOption "Haskell programming language."; options.haskell.enable = lib.mkEnableOption "Haskell programming language.";
config = lib.mkIf config.haskell.enable { config = lib.mkIf config.haskell.enable {
# Binary Cache for Haskell.nix # Binary Cache for Haskell.nix
nix.settings.trusted-public-keys = nix.settings.trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
[ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
nix.settings.substituters = [ "https://cache.iog.io" ]; nix.settings.substituters = [ "https://cache.iog.io" ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.kubernetes.enable = lib.mkEnableOption "Kubernetes tools."; options.kubernetes.enable = lib.mkEnableOption "Kubernetes tools.";
@ -99,12 +105,16 @@
views = { views = {
charts = { charts = {
bgColor = "default"; bgColor = "default";
defaultDialColors = defaultDialColors = [
[ config.theme.colors.base0D config.theme.colors.base08 ]; config.theme.colors.base0D
config.theme.colors.base08
];
# - *blue # - *blue
# - *red # - *red
defaultChartColors = defaultChartColors = [
[ config.theme.colors.base0D config.theme.colors.base08 ]; config.theme.colors.base0D
config.theme.colors.base08
];
# - *blue # - *blue
# - *red # - *red
}; };
@ -149,9 +159,6 @@
}; };
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.lua.enable = lib.mkEnableOption "Lua programming language."; options.lua.enable = lib.mkEnableOption "Lua programming language.";
@ -8,5 +14,4 @@
sumneko-lua-language-server # Lua LSP sumneko-lua-language-server # Lua LSP
]; ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.nixlang.enable = lib.mkEnableOption "Nix programming language."; options.nixlang.enable = lib.mkEnableOption "Nix programming language.";

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.python.enable = lib.mkEnableOption "Python programming language."; options.python.enable = lib.mkEnableOption "Python programming language.";
@ -13,10 +19,9 @@
python310Packages.flake8 # Python linter python310Packages.flake8 # Python linter
]; ];
programs.fish.shellAbbrs = { py = "python3"; }; programs.fish.shellAbbrs = {
py = "python3";
};
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.rust.enable = lib.mkEnableOption "Rust programming language."; options.rust.enable = lib.mkEnableOption "Rust programming language.";
@ -6,12 +12,16 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.fish.shellAbbrs = { ca = "cargo"; }; programs.fish.shellAbbrs = {
ca = "cargo";
home.packages = with pkgs; [ cargo rustc clippy gcc ]; };
home.packages = with pkgs; [
cargo
rustc
clippy
gcc
];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.terraform.enable = lib.mkEnableOption "Terraform tools."; options.terraform.enable = lib.mkEnableOption "Terraform tools.";
@ -15,9 +21,6 @@
terraform-ls # Language server terraform-ls # Language server
tflint # Linter tflint # Linter
]; ];
}; };
}; };
} }

View File

@ -1,5 +1,8 @@
{ ... }: { { ... }:
{
imports = [ ./dotfiles.nix ./notes.nix ];
imports = [
./dotfiles.nix
./notes.nix
];
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Allows me to make sure I can work on my dotfiles locally # Allows me to make sure I can work on my dotfiles locally
@ -11,23 +17,17 @@
home.activation = { home.activation = {
# Always clone dotfiles repository if it doesn't exist # Always clone dotfiles repository if it doesn't exist
cloneDotfiles = cloneDotfiles = config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
config.home-manager.users.${config.user}.lib.dag.entryAfter if [ ! -d "${config.dotfilesPath}" ]; then
[ "writeBoundary" ] '' $DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
if [ ! -d "${config.dotfilesPath}" ]; then $DRY_RUN_CMD ${pkgs.git}/bin/git \
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}") clone ${config.dotfilesRepo} "${config.dotfilesPath}"
$DRY_RUN_CMD ${pkgs.git}/bin/git \ fi
clone ${config.dotfilesRepo} "${config.dotfilesPath}" '';
fi
'';
}; };
# Set a variable for dotfiles repo, not necessary but convenient # Set a variable for dotfiles repo, not necessary but convenient
home.sessionVariables.DOTS = config.dotfilesPath; home.sessionVariables.DOTS = config.dotfilesPath;
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, lib, ... }: { { config, lib, ... }:
{
# Shell history sync # Shell history sync
@ -10,7 +11,10 @@
programs.atuin = { programs.atuin = {
enable = true; enable = true;
flags = [ "--disable-up-arrow" "--disable-ctrl-r" ]; flags = [
"--disable-up-arrow"
"--disable-ctrl-r"
];
settings = { settings = {
auto_sync = true; auto_sync = true;
update_check = false; update_check = false;
@ -27,13 +31,9 @@
keymap_mode = "vim-normal"; keymap_mode = "vim-normal";
}; };
}; };
}; };
# Give root user the same setup # Give root user the same setup
home-manager.users.root.programs.atuin = home-manager.users.root.programs.atuin = config.home-manager.users.${config.user}.programs.atuin;
config.home-manager.users.${config.user}.programs.atuin;
}; };
} }

View File

@ -1,12 +1,17 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = { config = {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.bash = { programs.bash = {
enable = true; enable = true;
shellAliases = shellAliases = config.home-manager.users.${config.user}.programs.fish.shellAliases;
config.home-manager.users.${config.user}.programs.fish.shellAliases;
initExtra = ""; initExtra = "";
profileExtra = ""; profileExtra = "";
}; };
@ -14,7 +19,6 @@
programs.starship.enableBashIntegration = false; programs.starship.enableBashIntegration = false;
programs.zoxide.enableBashIntegration = true; programs.zoxide.enableBashIntegration = true;
programs.fzf.enableBashIntegration = true; programs.fzf.enableBashIntegration = true;
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Convenience utilities from charm.sh # Convenience utilities from charm.sh
@ -12,7 +18,5 @@
charm # Manage account and filesystem charm # Manage account and filesystem
pop # Send emails from a TUI pop # Send emails from a TUI
]; ];
}; };
} }

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./atuin.nix ./atuin.nix
./bash ./bash

View File

@ -1,10 +1,15 @@
{ config, ... }: { { config, ... }:
{
# Enables quickly entering Nix shells when changing directories # Enables quickly entering Nix shells when changing directories
home-manager.users.${config.user}.programs.direnv = { home-manager.users.${config.user}.programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
config = { whitelist = { prefix = [ config.dotfilesPath ]; }; }; config = {
whitelist = {
prefix = [ config.dotfilesPath ];
};
};
}; };
# programs.direnv.direnvrcExtra = '' # programs.direnv.direnvrcExtra = ''
@ -28,5 +33,4 @@
keep-outputs = true keep-outputs = true
keep-derivations = true keep-derivations = true
''; '';
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
users.users.${config.user}.shell = pkgs.fish; users.users.${config.user}.shell = pkgs.fish;
programs.fish.enable = true; # Needed for LightDM to remember username programs.fish.enable = true; # Needed for LightDM to remember username
@ -46,7 +52,9 @@
fish_user_key_bindings = { fish_user_key_bindings = {
body = builtins.readFile ./functions/fish_user_key_bindings.fish; body = builtins.readFile ./functions/fish_user_key_bindings.fish;
}; };
ip = { body = builtins.readFile ./functions/ip.fish; }; ip = {
body = builtins.readFile ./functions/ip.fish;
};
json = { json = {
description = "Tidy up JSON using jq"; description = "Tidy up JSON using jq";
body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS
@ -112,8 +120,7 @@
moon = "curl wttr.in/Moon"; moon = "curl wttr.in/Moon";
# Cheat Sheets # Cheat Sheets
ssl = ssl = "openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
"openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -"; fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -";
publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub"; publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub";
forloop = "for i in (seq 1 100)"; forloop = "for i in (seq 1 100)";
@ -122,7 +129,6 @@
dc = "$DOTS/bin/docker_cleanup"; dc = "$DOTS/bin/docker_cleanup";
dr = "docker run --rm -it"; dr = "docker run --rm -it";
db = "docker build . -t"; db = "docker build . -t";
}; };
shellInit = ""; shellInit = "";
}; };
@ -132,6 +138,5 @@
programs.starship.enableFishIntegration = true; programs.starship.enableFishIntegration = true;
programs.zoxide.enableFishIntegration = true; programs.zoxide.enableFishIntegration = true;
programs.fzf.enableFishIntegration = true; programs.fzf.enableFishIntegration = true;
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, pkgs, ... }: { { config, pkgs, ... }:
{
# FZF is a fuzzy-finder for the terminal # FZF is a fuzzy-finder for the terminal
@ -25,17 +26,20 @@
''; '';
}; };
}; };
shellAbbrs = { lsf = "ls -lh | fzf"; }; shellAbbrs = {
lsf = "ls -lh | fzf";
};
}; };
# Global fzf configuration # Global fzf configuration
home.sessionVariables = let fzfCommand = "fd --type file"; home.sessionVariables =
in { let
FZF_DEFAULT_COMMAND = fzfCommand; fzfCommand = "fd --type file";
FZF_CTRL_T_COMMAND = fzfCommand; in
FZF_DEFAULT_OPTS = "-m --height 50% --border"; {
}; FZF_DEFAULT_COMMAND = fzfCommand;
FZF_CTRL_T_COMMAND = fzfCommand;
FZF_DEFAULT_OPTS = "-m --height 50% --border";
};
}; };
} }

View File

@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let home-packages = config.home-manager.users.${config.user}.home.packages; let
home-packages = config.home-manager.users.${config.user}.home.packages;
in { in
{
options = { options = {
gitName = lib.mkOption { gitName = lib.mkOption {
@ -28,16 +34,26 @@ in {
userName = config.gitName; userName = config.gitName;
userEmail = config.gitEmail; userEmail = config.gitEmail;
extraConfig = { extraConfig = {
core.pager = core.pager = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F";
"${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F"; interactive.difffilter = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight";
interactive.difffilter = pager = {
"${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight"; branch = "false";
pager = { branch = "false"; }; };
safe = { directory = config.dotfilesPath; }; safe = {
pull = { ff = "only"; }; directory = config.dotfilesPath;
push = { autoSetupRemote = "true"; }; };
init = { defaultBranch = "master"; }; pull = {
rebase = { autosquash = "true"; }; ff = "only";
};
push = {
autoSetupRemote = "true";
};
init = {
defaultBranch = "master";
};
rebase = {
autosquash = "true";
};
gpg = { gpg = {
format = "ssh"; format = "ssh";
ssh.allowedSignersFile = "~/.config/git/allowed-signers"; ssh.allowedSignersFile = "~/.config/git/allowed-signers";
@ -45,11 +61,16 @@ in {
# commit.gpgsign = true; # commit.gpgsign = true;
# tag.gpgsign = true; # tag.gpgsign = true;
}; };
ignores = [ ".direnv/**" "result" ]; ignores = [
includes = [{ ".direnv/**"
path = "~/.config/git/personal"; "result"
condition = "gitdir:~/dev/personal/"; ];
}]; includes = [
{
path = "~/.config/git/personal";
condition = "gitdir:~/dev/personal/";
}
];
}; };
# Personal git config # Personal git config
@ -86,8 +107,7 @@ in {
gl = "git log --graph --decorate --oneline -20"; gl = "git log --graph --decorate --oneline -20";
gll = "git log --graph --decorate --oneline"; gll = "git log --graph --decorate --oneline";
gco = "git checkout"; gco = "git checkout";
gcom = '' gcom = ''git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
gcob = "git switch -c"; gcob = "git switch -c";
gb = "git branch"; gb = "git branch";
gpd = "git push origin -d"; gpd = "git push origin -d";
@ -101,58 +121,63 @@ in {
}; };
# Required for fish commands # Required for fish commands
home.packages = with pkgs; [ fish fzf bat ]; home.packages = with pkgs; [
fish
fzf
bat
];
programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages programs.fish.functions =
&& builtins.elem pkgs.bat home-packages) { 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 = { git = {
body = builtins.readFile ./fish/functions/git-add-fuzzy.fish; 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-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;
};
}; };
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-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;
};
};
}; };
}; };
} }

View File

@ -1,40 +1,43 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.gh = programs.gh = lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
lib.mkIf config.home-manager.users.${config.user}.programs.git.enable { enable = true;
enable = true; gitCredentialHelper.enable = true;
gitCredentialHelper.enable = true; settings.git_protocol = "https";
settings.git_protocol = "https"; extensions = [ pkgs.gh-collaborators ];
extensions = [ pkgs.gh-collaborators ]; };
programs.fish = lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
shellAbbrs = {
ghr = "gh repo view -w";
gha = "gh run list | head -1 | awk '{ print \\$\\(NF-2\\) }' | xargs gh run view";
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
ghpr = "gh pr create && sleep 3 && gh run watch";
# https://github.com/cli/cli/discussions/4067
prs = "gh search prs --state=open --review-requested=@me";
}; };
functions = {
programs.fish = repos = {
lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable { description = "Clone GitHub repositories";
shellAbbrs = { argumentNames = "organization";
ghr = "gh repo view -w"; body = ''
gha = set directory (gh-repos $organization)
"gh run list | head -1 | awk '{ print \\$\\(NF-2\\) }' | xargs gh run view"; and cd $directory
grw = "gh run watch"; '';
grf = "gh run view --log-failed";
grl = "gh run view --log";
ghpr = "gh pr create && sleep 3 && gh run watch";
# https://github.com/cli/cli/discussions/4067
prs = "gh search prs --state=open --review-requested=@me";
};
functions = {
repos = {
description = "Clone GitHub repositories";
argumentNames = "organization";
body = ''
set directory (gh-repos $organization)
and cd $directory
'';
};
}; };
}; };
};
home.packages = [ home.packages = [
(pkgs.writeShellScriptBin "gh-repos" '' (pkgs.writeShellScriptBin "gh-repos" ''
@ -76,7 +79,5 @@
} }
'') '')
]; ];
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, ... }: { { config, ... }:
{
config = { config = {
@ -9,12 +10,9 @@
settings = { settings = {
user = { user = {
name = config.home-manager.users.${config.user}.programs.git.userName; name = config.home-manager.users.${config.user}.programs.git.userName;
email = email = config.home-manager.users.${config.user}.programs.git.userEmail;
config.home-manager.users.${config.user}.programs.git.userEmail;
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.fish = { programs.fish = {
@ -62,22 +68,22 @@
# Create nix-index if doesn't exist # Create nix-index if doesn't exist
home.activation.createNixIndex = home.activation.createNixIndex =
let cacheDir = "${config.homePath}/.cache/nix-index"; let
in lib.mkIf cacheDir = "${config.homePath}/.cache/nix-index";
config.home-manager.users.${config.user}.programs.nix-index.enable in
(config.home-manager.users.${config.user}.lib.dag.entryAfter lib.mkIf config.home-manager.users.${config.user}.programs.nix-index.enable (
[ "writeBoundary" ] '' config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d ${cacheDir} ]; then if [ ! -d ${cacheDir} ]; then
$DRY_RUN_CMD ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path} $DRY_RUN_CMD ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path}
fi fi
''); ''
);
# Set automatic generation cleanup for home-manager # Set automatic generation cleanup for home-manager
nix.gc = { nix.gc = {
automatic = config.nix.gc.automatic; automatic = config.nix.gc.automatic;
options = config.nix.gc.options; options = config.nix.gc.options;
}; };
}; };
nix = { nix = {
@ -92,7 +98,10 @@
}; };
# For security, only allow specific users # For security, only allow specific users
settings.allowed-users = [ "@wheel" config.user ]; settings.allowed-users = [
"@wheel"
config.user
];
# Enable features in Nix commands # Enable features in Nix commands
extraOptions = '' extraOptions = ''
@ -110,8 +119,7 @@
# Add community Cachix to binary cache # Add community Cachix to binary cache
# Don't use with macOS because blocked by corporate firewall # Don't use with macOS because blocked by corporate firewall
builders-use-substitutes = true; builders-use-substitutes = true;
substituters = substituters = lib.mkIf (!pkgs.stdenv.isDarwin) [ "https://nix-community.cachix.org" ];
lib.mkIf (!pkgs.stdenv.isDarwin) [ "https://nix-community.cachix.org" ];
trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [ trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
@ -119,9 +127,6 @@
# Scans and hard links identical files in the store # Scans and hard links identical files in the store
# Not working with macOS: https://github.com/NixOS/nix/issues/7273 # Not working with macOS: https://github.com/NixOS/nix/issues/7273
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true; auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user}.programs.starship = { home-manager.users.${config.user}.programs.starship = {
enable = true; enable = true;
@ -29,7 +35,9 @@
truncate_to_repo = true; truncate_to_repo = true;
truncation_length = 100; truncation_length = 100;
}; };
git_branch = { format = "[$symbol$branch]($style)"; }; git_branch = {
format = "[$symbol$branch]($style)";
};
git_commit = { git_commit = {
format = "( @ [$hash]($style) )"; format = "( @ [$hash]($style) )";
only_detached = false; only_detached = false;
@ -56,8 +64,9 @@
format = "[$symbol $name]($style)"; format = "[$symbol $name]($style)";
symbol = ""; symbol = "";
}; };
python = { format = "[\${version}\\(\${virtualenv}\\)]($style)"; }; python = {
format = "[\${version}\\(\${virtualenv}\\)]($style)";
};
}; };
}; };
} }

View File

@ -10,8 +10,8 @@ let
.terraform/ .terraform/
.target/ .target/
/Library/''; /Library/'';
in
in { {
config = { config = {
@ -70,9 +70,6 @@ in {
body = "${pkgs.prettyping}/bin/prettyping --nolegend $target"; body = "${pkgs.prettyping}/bin/prettyping --nolegend $target";
}; };
}; };
}; };
}; };
} }

View File

@ -1,46 +1,52 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
home.packages = let home.packages =
ldap_scheme = "ldaps"; let
magic_number = "2"; ldap_scheme = "ldaps";
magic_end_seq = "corp"; magic_number = "2";
magic_prefix = "take"; magic_end_seq = "corp";
ldap_host = magic_prefix = "take";
"${magic_prefix}${magic_number}.t${magic_number}.${magic_end_seq}"; ldap_host = "${magic_prefix}${magic_number}.t${magic_number}.${magic_end_seq}";
ldap_port = 636; ldap_port = 636;
ldap_dc_1 = "${magic_prefix}${magic_number}"; ldap_dc_1 = "${magic_prefix}${magic_number}";
ldap_dc_2 = "t${magic_number}"; ldap_dc_2 = "t${magic_number}";
ldap_dc_3 = magic_end_seq; ldap_dc_3 = magic_end_seq;
ldap_script = pkgs.writeShellScriptBin "ldap" '' ldap_script = pkgs.writeShellScriptBin "ldap" ''
# if ! [ "$LDAP_HOST" ]; then # if ! [ "$LDAP_HOST" ]; then
# echo "No LDAP_HOST specified!" # echo "No LDAP_HOST specified!"
# exit 1 # exit 1
# fi # fi
SEARCH_FILTER="$@" SEARCH_FILTER="$@"
ldapsearch -LLL \ ldapsearch -LLL \
-B -o ldif-wrap=no \ -B -o ldif-wrap=no \
-H "${ldap_scheme}://${ldap_host}:${builtins.toString ldap_port}" \ -H "${ldap_scheme}://${ldap_host}:${builtins.toString ldap_port}" \
-D "${pkgs.lib.toUpper magic_prefix}${magic_number}\\${ -D "${pkgs.lib.toUpper magic_prefix}${magic_number}\\${pkgs.lib.toLower config.user}" \
pkgs.lib.toLower config.user -w "$(${pkgs._1password}/bin/op item get T${magic_number} --fields label=password)" \
}" \ -b "DC=${ldap_dc_1},DC=${ldap_dc_2},DC=${ldap_dc_3}" \
-w "$(${pkgs._1password}/bin/op item get T${magic_number} --fields label=password)" \ -s "sub" -x "(cn=$SEARCH_FILTER)" \
-b "DC=${ldap_dc_1},DC=${ldap_dc_2},DC=${ldap_dc_3}" \ | jq --slurp \
-s "sub" -x "(cn=$SEARCH_FILTER)" \ --raw-input 'split("\n\n")|map(split("\n")|map(select(.[0:1]!="#" and length>0)) |select(length > 0)|map(capture("^(?<key>[^:]*:?): *(?<value>.*)") |if .key[-1:.key|length] == ":" then .key=.key[0:-1]|.value=(.value|@base64d) else . end)| group_by(.key) | map({key:.[0].key,value:(if .|length > 1 then [.[].value] else .[].value end)}) | from_entries)' | jq -r 'del(.[].thumbnailPhoto)'
| jq --slurp \ '';
--raw-input 'split("\n\n")|map(split("\n")|map(select(.[0:1]!="#" and length>0)) |select(length > 0)|map(capture("^(?<key>[^:]*:?): *(?<value>.*)") |if .key[-1:.key|length] == ":" then .key=.key[0:-1]|.value=(.value|@base64d) else . end)| group_by(.key) | map({key:.[0].key,value:(if .|length > 1 then [.[].value] else .[].value end)}) | from_entries)' | jq -r 'del(.[].thumbnailPhoto)' ldapm_script = pkgs.writeShellScriptBin "ldapm" ''
''; ${ldap_script}/bin/ldap "$@" | jq '[ .[].memberOf] | add'
ldapm_script = pkgs.writeShellScriptBin "ldapm" '' '';
${ldap_script}/bin/ldap "$@" | jq '[ .[].memberOf] | add' ldapg_script = pkgs.writeShellScriptBin "ldapg" ''
''; ${ldap_script}/bin/ldap "$@" | jq '[ .[].member] | add'
ldapg_script = pkgs.writeShellScriptBin "ldapg" '' '';
${ldap_script}/bin/ldap "$@" | jq '[ .[].member] | add' in
''; [
in [ ldap_script ldapm_script ldapg_script ]; ldap_script
ldapm_script
ldapg_script
];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# MacOS-specific settings for Alacritty # MacOS-specific settings for Alacritty
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -647,5 +653,4 @@
]; ];
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./alacritty.nix ./alacritty.nix
@ -14,5 +15,4 @@
./user.nix ./user.nix
./utilities.nix ./utilities.nix
]; ];
} }

View File

@ -1,11 +1,10 @@
{ pkgs, ... }: { { pkgs, ... }:
{
config = { config = {
# MacOS-specific settings for Fish # MacOS-specific settings for Fish
programs.fish.useBabelfish = true; programs.fish.useBabelfish = true;
programs.fish.babelfishPackage = pkgs.babelfish; programs.fish.babelfishPackage = pkgs.babelfish;
}; };
} }

View File

@ -1,17 +1,22 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
home.packages = with pkgs; home.packages = with pkgs; [ (nerdfonts.override { fonts = [ "VictorMono" ]; }) ];
[ (nerdfonts.override { fonts = [ "VictorMono" ]; }) ];
programs.alacritty.settings = { font.normal.family = "VictorMono"; }; programs.alacritty.settings = {
font.normal.family = "VictorMono";
};
programs.kitty.font = { programs.kitty.font = {
package = (pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; }); package = (pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; });
name = "VictorMono Nerd Font Mono"; name = "VictorMono Nerd Font Mono";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Hammerspoon - MacOS custom automation scripting # Hammerspoon - MacOS custom automation scripting
@ -6,30 +12,25 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua; xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua;
xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = ./hammerspoon/Spoons/ControlEscape.spoon;
./hammerspoon/Spoons/ControlEscape.spoon; xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = ./hammerspoon/Spoons/DismissAlerts.spoon;
xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = pkgs.substituteAll {
./hammerspoon/Spoons/DismissAlerts.spoon; src = ./hammerspoon/Spoons/Launcher.spoon/init.lua;
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = firefox = "${pkgs.firefox-bin}/Applications/Firefox.app";
pkgs.substituteAll { discord = "${pkgs.discord}/Applications/Discord.app";
src = ./hammerspoon/Spoons/Launcher.spoon/init.lua; kitty = "${pkgs.kitty}/Applications/kitty.app";
firefox = "${pkgs.firefox-bin}/Applications/Firefox.app"; obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
discord = "${pkgs.discord}/Applications/Discord.app"; slack = "${pkgs.slack}/Applications/Slack.app";
kitty = "${pkgs.kitty}/Applications/kitty.app"; };
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app"; xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./hammerspoon/Spoons/MoveWindow.spoon;
slack = "${pkgs.slack}/Applications/Slack.app";
};
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source =
./hammerspoon/Spoons/MoveWindow.spoon;
home.activation.reloadHammerspoon = home.activation.reloadHammerspoon =
config.home-manager.users.${config.user}.lib.dag.entryAfter config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ]
[ "writeBoundary" ] '' ''
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()" $DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
$DRY_RUN_CMD sleep 1 $DRY_RUN_CMD sleep 1
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()" $DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
''; '';
}; };
homebrew.casks = [ "hammerspoon" ]; homebrew.casks = [ "hammerspoon" ];
@ -38,7 +39,5 @@
defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua" defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua"
sudo killall Dock sudo killall Dock
''; '';
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Homebrew - Mac-specific packages that aren't in Nix # Homebrew - Mac-specific packages that aren't in Nix
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
@ -14,8 +20,7 @@
''; '';
# Add homebrew paths to CLI path # Add homebrew paths to CLI path
home-manager.users.${config.user}.home.sessionPath = home-manager.users.${config.user}.home.sessionPath = [ "/opt/homebrew/bin/" ];
[ "/opt/homebrew/bin/" ];
homebrew = { homebrew = {
enable = true; enable = true;
@ -43,7 +48,5 @@
# "epic-games" # Not packaged for Nix # "epic-games" # Not packaged for Nix
]; ];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# MacOS-specific settings for Kitty # MacOS-specific settings for Kitty
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -13,5 +19,4 @@
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
networking = { networking = {
@ -7,5 +13,4 @@
# hostName = ""; # hostName = "";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -27,7 +33,5 @@
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
@ -102,7 +108,6 @@
"${pkgs.kitty}/Applications/kitty.app" "${pkgs.kitty}/Applications/kitty.app"
"/System/Applications/System Settings.app" "/System/Applications/System Settings.app"
]; ];
}; };
finder = { finder = {
@ -118,7 +123,6 @@
# Allow quitting of Finder application # Allow quitting of Finder application
QuitMenuItem = true; QuitMenuItem = true;
}; };
# Disable "Are you sure you want to open" dialog # Disable "Are you sure you want to open" dialog
@ -165,12 +169,9 @@
eventTimeFormat = ''"show"''; eventTimeFormat = ''"show"'';
eventTitleFormat = ''"none"''; eventTitleFormat = ''"none"'';
eventTitleIconFormat = ''"iconCalendar"''; eventTitleIconFormat = ''"iconCalendar"'';
slackBrowser = slackBrowser = ''{"deletable":true,"arguments":"","name":"Slack","path":""}'';
''{"deletable":true,"arguments":"","name":"Slack","path":""}''; zoomBrowser = ''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
zoomBrowser = KeyboardShortcuts_joinEventShortcut = ''{"carbonModifiers":6400,"carbonKeyCode":38}'';
''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
KeyboardShortcuts_joinEventShortcut =
''{"carbonModifiers":6400,"carbonKeyCode":38}'';
timeFormat = ''"12-hour"''; timeFormat = ''"12-hour"'';
}; };
}; };
@ -178,7 +179,6 @@
CustomSystemPreferences = { CustomSystemPreferences = {
}; };
}; };
# Settings that don't have an option in nix-darwin # Settings that don't have an option in nix-darwin
@ -199,9 +199,6 @@
defaults write -globalDomain NSStatusItemSelectionPadding -int 6 defaults write -globalDomain NSStatusItemSelectionPadding -int 6
defaults write -globalDomain NSStatusItemSpacing -int 6 defaults write -globalDomain NSStatusItemSpacing -int 6
''; '';
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.tmux.enable = lib.mkEnableOption "Tmux terminal multiplexer"; options.tmux.enable = lib.mkEnableOption "Tmux terminal multiplexer";
@ -127,7 +133,5 @@
tan = "tmux attach-session -t noah"; tan = "tmux attach-session -t noah";
tnn = "tmux new-session -s noah"; tnn = "tmux new-session -s noah";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
@ -6,22 +12,20 @@
# macOS user # macOS user
home = config.homePath; home = config.homePath;
shell = pkgs.fish; # Default shell shell = pkgs.fish; # Default shell
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Default shell setting doesn't work # Default shell setting doesn't work
home.sessionVariables = { SHELL = "${pkgs.fish}/bin/fish"; }; home.sessionVariables = {
SHELL = "${pkgs.fish}/bin/fish";
};
# Used for aerc # Used for aerc
xdg.enable = true; xdg.enable = true;
}; };
# Fix for: 'Error: HOME is set to "/var/root" but we expect "/var/empty"' # Fix for: 'Error: HOME is set to "/var/root" but we expect "/var/empty"'
home-manager.users.root.home.homeDirectory = lib.mkForce "/var/root"; home-manager.users.root.home.homeDirectory = lib.mkForce "/var/root";
}; };
} }

View File

@ -1,8 +1,16 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
unfreePackages = [ "consul" "vault-bin" ]; unfreePackages = [
"consul"
"vault-bin"
];
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -38,7 +46,5 @@
# Shortcut to edit hosts file # Shortcut to edit hosts file
hosts = "sudo nvim /etc/hosts"; hosts = "sudo nvim /etc/hosts";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
calibre = { calibre = {
@ -16,6 +22,8 @@
}; };
# Forces Calibre to use dark mode # Forces Calibre to use dark mode
environment.sessionVariables = { CALIBRE_USE_DARK_PALETTE = "1"; }; environment.sessionVariables = {
CALIBRE_USE_DARK_PALETTE = "1";
};
}; };
} }

View File

@ -1,5 +1,8 @@
{ ... }: { { ... }:
{
imports = [ ./calibre.nix ./nautilus.nix ];
imports = [
./calibre.nix
./nautilus.nix
];
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
nautilus = { nautilus = {
@ -28,18 +34,15 @@
# Generates a QR code and previews it with sushi # Generates a QR code and previews it with sushi
programs.fish.functions = { programs.fish.functions = {
qr = { qr = {
body = body = "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
"${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
}; };
}; };
# Set Nautilus as default for opening directories # Set Nautilus as default for opening directories
xdg.mimeApps = { xdg.mimeApps = {
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ]; associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
defaultApplications."inode/directory" = defaultApplications."inode/directory" = lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
}; };
}; };
# Delete Trash files older than 1 week # Delete Trash files older than 1 week
@ -48,7 +51,5 @@
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
script = "${pkgs.trash-cli}/bin/trash-empty 7"; script = "${pkgs.trash-cli}/bin/trash-empty 7";
}; };
}; };
} }

View File

@ -1,6 +1,12 @@
{ ... }: { { ... }:
{
imports =
[ ./applications ./gaming ./graphical ./hardware ./services ./system ];
imports = [
./applications
./gaming
./graphical
./hardware
./services
./system
];
} }

View File

@ -1,10 +1,14 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.chiaki.enable = options.gaming.chiaki.enable = lib.mkEnableOption "Chiaki PlayStation remote play client.";
lib.mkEnableOption "Chiaki PlayStation remote play client.";
config = lib.mkIf config.gaming.chiaki.enable { config = lib.mkIf config.gaming.chiaki.enable {
environment.systemPackages = with pkgs; [ chiaki ]; environment.systemPackages = with pkgs; [ chiaki ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
imports = [ imports = [
./chiaki.nix ./chiaki.nix

View File

@ -1,29 +1,34 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.dwarf-fortress.enable = options.gaming.dwarf-fortress.enable = lib.mkEnableOption "Dwarf Fortress free edition.";
lib.mkEnableOption "Dwarf Fortress free edition.";
config = lib.mkIf config.gaming.dwarf-fortress.enable { config = lib.mkIf config.gaming.dwarf-fortress.enable {
unfreePackages = [ "dwarf-fortress" ]; unfreePackages = [ "dwarf-fortress" ];
environment.systemPackages = let environment.systemPackages =
dfDesktopItem = pkgs.makeDesktopItem { let
name = "dwarf-fortress"; dfDesktopItem = pkgs.makeDesktopItem {
desktopName = "Dwarf Fortress"; name = "dwarf-fortress";
exec = "${pkgs.dwarf-fortress-packages.dwarf-fortress-full}/bin/dfhack"; desktopName = "Dwarf Fortress";
terminal = false; exec = "${pkgs.dwarf-fortress-packages.dwarf-fortress-full}/bin/dfhack";
}; terminal = false;
dtDesktopItem = pkgs.makeDesktopItem { };
name = "dwarftherapist"; dtDesktopItem = pkgs.makeDesktopItem {
desktopName = "Dwarf Therapist"; name = "dwarftherapist";
exec = desktopName = "Dwarf Therapist";
"${pkgs.dwarf-fortress-packages.dwarf-fortress-full}/bin/dwarftherapist"; exec = "${pkgs.dwarf-fortress-packages.dwarf-fortress-full}/bin/dwarftherapist";
terminal = false; terminal = false;
}; };
in [ in
pkgs.dwarf-fortress-packages.dwarf-fortress-full [
dfDesktopItem pkgs.dwarf-fortress-packages.dwarf-fortress-full
dtDesktopItem dfDesktopItem
]; dtDesktopItem
];
}; };
} }

View File

@ -1,11 +1,16 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let home-packages = config.home-manager.users.${config.user}.home.packages; let
home-packages = config.home-manager.users.${config.user}.home.packages;
in
{
in { options.gaming.legendary.enable = lib.mkEnableOption "Legendary Epic Games launcher.";
options.gaming.legendary.enable =
lib.mkEnableOption "Legendary Epic Games launcher.";
config = lib.mkIf config.gaming.legendary.enable { config = lib.mkIf config.gaming.legendary.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -28,29 +33,28 @@ in {
log_level = error log_level = error
''; '';
home.file = let home.file =
ignorePatterns = '' let
.wine/ ignorePatterns = ''
drive_c/''; .wine/
in { drive_c/'';
".rgignore".text = ignorePatterns; in
".fdignore".text = ignorePatterns; {
}; ".rgignore".text = ignorePatterns;
".fdignore".text = ignorePatterns;
programs.fish.functions =
lib.mkIf (builtins.elem pkgs.fzf home-packages) {
epic-games = {
body = ''
set game (legendary list 2>/dev/null \
| awk '/^ \* / { print $0; }' \
| sed -e 's/ (.*)$//' -e 's/ \* //' \
| fzf)
and legendary launch "$game" &> /dev/null
'';
};
}; };
programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages) {
epic-games = {
body = ''
set game (legendary list 2>/dev/null \
| awk '/^ \* / { print $0; }' \
| sed -e 's/ (.*)$//' -e 's/ \* //' \
| fzf)
and legendary launch "$game" &> /dev/null
'';
};
};
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.lutris.enable = lib.mkEnableOption "Lutris game installer."; options.gaming.lutris.enable = lib.mkEnableOption "Lutris game installer.";
@ -9,5 +15,4 @@
wineWowPackages.stable # 32-bit and 64-bit wineWowPackages wineWowPackages.stable # 32-bit and 64-bit wineWowPackages
]; ];
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
@ -6,8 +11,8 @@ let
publicPort = 49732; publicPort = 49732;
rconPort = 25575; rconPort = 25575;
rconPassword = "thiscanbeanything"; rconPassword = "thiscanbeanything";
in
in { {
config = lib.mkIf config.services.minecraft-server.enable { config = lib.mkIf config.services.minecraft-server.enable {
@ -52,7 +57,9 @@ in {
# https://dataswamp.org/~solene/2022-08-20-on-demand-minecraft-with-systemd.html # https://dataswamp.org/~solene/2022-08-20-on-demand-minecraft-with-systemd.html
# Prevent Minecraft from starting by default # Prevent Minecraft from starting by default
systemd.services.minecraft-server = { wantedBy = pkgs.lib.mkForce [ ]; }; systemd.services.minecraft-server = {
wantedBy = pkgs.lib.mkForce [ ];
};
# Listen for connections on the public port, to trigger the actual # Listen for connections on the public port, to trigger the actual
# listen-minecraft service. # listen-minecraft service.
@ -65,18 +72,25 @@ in {
# Proxy traffic to local port, and trigger hook-minecraft # Proxy traffic to local port, and trigger hook-minecraft
systemd.services.listen-minecraft = { systemd.services.listen-minecraft = {
path = [ pkgs.systemd ]; path = [ pkgs.systemd ];
requires = [ "hook-minecraft.service" "listen-minecraft.socket" ]; requires = [
after = [ "hook-minecraft.service" "listen-minecraft.socket" ]; "hook-minecraft.service"
serviceConfig.ExecStart = "listen-minecraft.socket"
"${pkgs.systemd.out}/lib/systemd/systemd-socket-proxyd 127.0.0.1:${ ];
toString localPort after = [
}"; "hook-minecraft.service"
"listen-minecraft.socket"
];
serviceConfig.ExecStart = "${pkgs.systemd.out}/lib/systemd/systemd-socket-proxyd 127.0.0.1:${toString localPort}";
}; };
# Start Minecraft if required and wait for it to be available # Start Minecraft if required and wait for it to be available
# Then unlock the listen-minecraft.service # Then unlock the listen-minecraft.service
systemd.services.hook-minecraft = { systemd.services.hook-minecraft = {
path = with pkgs; [ systemd libressl busybox ]; path = with pkgs; [
systemd
libressl
busybox
];
# Start Minecraft and the auto-shutdown timer # Start Minecraft and the auto-shutdown timer
script = '' script = ''
@ -87,9 +101,7 @@ in {
# Keep checking until the service is available # Keep checking until the service is available
postStart = '' postStart = ''
for i in $(seq 60); do for i in $(seq 60); do
if ${pkgs.libressl.nc}/bin/nc -z 127.0.0.1 ${ if ${pkgs.libressl.nc}/bin/nc -z 127.0.0.1 ${toString localPort} > /dev/null ; then
toString localPort
} > /dev/null ; then
exit 0 exit 0
fi fi
${pkgs.busybox.out}/bin/sleep 1 ${pkgs.busybox.out}/bin/sleep 1
@ -144,7 +156,5 @@ in {
fi fi
''; '';
}; };
}; };
} }

View File

@ -1,17 +1,19 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.ryujinx.enable = options.gaming.ryujinx.enable = lib.mkEnableOption "Ryujinx Nintendo Switch application.";
lib.mkEnableOption "Ryujinx Nintendo Switch application.";
config = lib.mkIf config.gaming.ryujinx.enable { config = lib.mkIf config.gaming.ryujinx.enable {
environment.systemPackages = with pkgs; [ ryujinx ]; environment.systemPackages = with pkgs; [ ryujinx ];
home-manager.users.${config.user}.xdg.desktopEntries.ryujinx = home-manager.users.${config.user}.xdg.desktopEntries.ryujinx = lib.mkIf pkgs.stdenv.isLinux {
lib.mkIf pkgs.stdenv.isLinux { name = "Ryujinx";
name = "Ryujinx"; exec = "env DOTNET_EnableAlternateStackCheck=1 Ryujinx -r /home/${config.user}/media/games/ryujinx/ %f";
exec = };
"env DOTNET_EnableAlternateStackCheck=1 Ryujinx -r /home/${config.user}/media/games/ryujinx/ %f";
};
}; };
} }

View File

@ -1,10 +1,21 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.steam.enable = lib.mkEnableOption "Steam game launcher."; options.gaming.steam.enable = lib.mkEnableOption "Steam game launcher.";
config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) { config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) {
hardware.steam-hardware.enable = true; hardware.steam-hardware.enable = true;
unfreePackages = [ "steam" "steam-original" "steamcmd" "steam-run" ]; unfreePackages = [
"steam"
"steam-original"
"steamcmd"
"steam-run"
];
programs.steam = { programs.steam = {
enable = true; enable = true;
@ -13,8 +24,7 @@
# Adapted in part from: https://github.com/Shawn8901/nix-configuration/blob/1c48be94238a9f463cf0bbd1e1842a4454286514/modules/nixos/steam-compat-tools/default.nix # Adapted in part from: https://github.com/Shawn8901/nix-configuration/blob/1c48be94238a9f463cf0bbd1e1842a4454286514/modules/nixos/steam-compat-tools/default.nix
# Based on: https://github.com/NixOS/nixpkgs/issues/73323 # Based on: https://github.com/NixOS/nixpkgs/issues/73323
extraEnv = { extraEnv = {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = STEAM_EXTRA_COMPAT_TOOLS_PATHS = lib.makeBinPath [ pkgs.proton-ge-custom ];
lib.makeBinPath [ pkgs.proton-ge-custom ];
}; };
}; };
}; };
@ -27,13 +37,10 @@
# Allow downloading of GE-Proton and other versions # Allow downloading of GE-Proton and other versions
protonup-qt protonup-qt
]; ];
# Seems like NetworkManager can help speed up Steam launch # 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/ # https://www.reddit.com/r/archlinux/comments/qguhco/steam_startup_time_arch_1451_seconds_fedora_34/hi8opet/
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
}; };
} }

View File

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
imports = [ imports = [
./dunst.nix ./dunst.nix
@ -49,7 +50,5 @@
type = lib.types.path; type = lib.types.path;
description = "Wallpaper background image file"; description = "Wallpaper background image file";
}; };
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
@ -8,7 +13,5 @@
home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ]; home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ];
gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run"; gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
}; };
} }

View File

@ -25,7 +25,5 @@
}; };
}; };
}; };
}; };
} }

View File

@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let fontName = "Victor Mono"; let
fontName = "Victor Mono";
in { in
{
config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) { config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) {
@ -24,7 +30,5 @@ in {
programs.kitty.font.name = fontName; programs.kitty.font.name = fontName;
services.dunst.settings.global.font = "Hack Nerd Font 14"; services.dunst.settings.global.font = "Hack Nerd Font 14";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
gtk.theme = { gtk.theme = {
@ -18,20 +24,21 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
gtk = let gtk =
gtkExtraConfig = { let
gtk-application-prefer-dark-theme = config.theme.dark; gtkExtraConfig = {
gtk-application-prefer-dark-theme = config.theme.dark;
};
in
{
enable = true;
theme = {
name = config.gtk.theme.name;
package = config.gtk.theme.package;
};
gtk3.extraConfig = gtkExtraConfig;
gtk4.extraConfig = gtkExtraConfig;
}; };
in {
enable = true;
theme = {
name = config.gtk.theme.name;
package = config.gtk.theme.package;
};
gtk3.extraConfig = gtkExtraConfig;
gtk4.extraConfig = gtkExtraConfig;
};
}; };
# Required for setting GTK theme (for preferred-color-scheme in browser) # Required for setting GTK theme (for preferred-color-scheme in browser)
@ -44,8 +51,8 @@
package = config.gtk.theme.package; package = config.gtk.theme.package;
}; };
environment.sessionVariables = { GTK_THEME = config.gtk.theme.name; }; environment.sessionVariables = {
GTK_THEME = config.gtk.theme.name;
};
}; };
} }

View File

@ -1,18 +1,23 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
lockCmd = lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span"; lockUpdate = "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
lockUpdate = in
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span"; {
in {
config = lib.mkIf pkgs.stdenv.isLinux { config = lib.mkIf pkgs.stdenv.isLinux {
services.xserver.windowManager = { services.xserver.windowManager = {
i3 = { enable = config.services.xserver.enable; }; i3 = {
enable = config.services.xserver.enable;
};
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -23,237 +28,221 @@ in {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = config.services.xserver.enable; enable = config.services.xserver.enable;
config = let config =
modifier = "Mod4"; # Super key let
ws1 = "1:I"; modifier = "Mod4"; # Super key
ws2 = "2:II"; ws1 = "1:I";
ws3 = "3:III"; ws2 = "2:II";
ws4 = "4:IV"; ws3 = "3:III";
ws5 = "5:V"; ws4 = "4:IV";
ws6 = "6:VI"; ws5 = "5:V";
ws7 = "7:VII"; ws6 = "6:VI";
ws8 = "8:VIII"; ws7 = "7:VII";
ws9 = "9:IX"; ws8 = "8:VIII";
ws10 = "10:X"; ws9 = "9:IX";
in { ws10 = "10:X";
modifier = modifier; in
assigns = { {
"${ws1}" = [{ class = "Firefox"; }]; modifier = modifier;
"${ws2}" = [ assigns = {
{ class = "kitty"; } "${ws1}" = [ { class = "Firefox"; } ];
{ class = "aerc"; } "${ws2}" = [
{ class = "obsidian"; } { class = "kitty"; }
{ class = "aerc"; }
{ class = "obsidian"; }
];
"${ws3}" = [ { class = "discord"; } ];
"${ws4}" = [
{ class = "steam"; }
{ class = "Steam"; }
];
};
bars = [ { command = "echo"; } ]; # Disable i3bar
colors =
let
background = config.theme.colors.base00;
inactiveBackground = config.theme.colors.base01;
border = config.theme.colors.base01;
inactiveBorder = config.theme.colors.base01;
text = config.theme.colors.base07;
inactiveText = config.theme.colors.base04;
urgentBackground = config.theme.colors.base08;
indicator = "#00000000";
in
{
background = config.theme.colors.base00;
focused = {
inherit
background
indicator
text
border
;
childBorder = background;
};
focusedInactive = {
inherit indicator;
background = inactiveBackground;
border = inactiveBorder;
childBorder = inactiveBackground;
text = inactiveText;
};
# placeholder = { };
unfocused = {
inherit indicator;
background = inactiveBackground;
border = inactiveBorder;
childBorder = inactiveBackground;
text = inactiveText;
};
urgent = {
inherit text indicator;
background = urgentBackground;
border = urgentBackground;
childBorder = urgentBackground;
};
};
floating.modifier = modifier;
focus = {
mouseWarping = true;
newWindow = "urgent";
followMouse = false;
};
keybindings = {
# Adjust screen brightness
"Shift+F12" =
# Disable dynamic sleep
# https://github.com/rockowitz/ddcutil/issues/323
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"Shift+F11" = "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
"XF86MonBrightnessUp" = "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"XF86MonBrightnessDown" = "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
# Media player controls
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
# Launchers
"${modifier}+Return" = "exec --no-startup-id kitty; workspace ${ws2}; layout tabbed";
"${modifier}+space" = "exec --no-startup-id ${config.launcherCommand}";
"${modifier}+Shift+s" = "exec --no-startup-id ${config.systemdSearch}";
"${modifier}+Shift+a" = "exec --no-startup-id ${config.audioSwitchCommand}";
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
"${modifier}+Shift+period" = "exec --no-startup-id ${config.powerCommand}";
"${modifier}+Shift+m" = "exec --no-startup-id ${config.brightnessCommand}";
"${modifier}+c" = "exec --no-startup-id ${config.calculatorCommand}";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = ''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = "exec ${lockCmd}";
"${modifier}+Mod1+h" = "exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"${modifier}+Mod1+r" = "exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
# Window options
"${modifier}+q" = "kill";
"${modifier}+b" = "exec ${config.toggleBarCommand}";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
# Tiling
"${modifier}+i" = "split h";
"${modifier}+v" = "split v";
"${modifier}+s" = "layout stacking";
"${modifier}+t" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+Control+space" = "focus mode_toggle";
"${modifier}+a" = "focus parent";
# Workspaces
"${modifier}+1" = "workspace ${ws1}";
"${modifier}+2" = "workspace ${ws2}";
"${modifier}+3" = "workspace ${ws3}";
"${modifier}+4" = "workspace ${ws4}";
"${modifier}+5" = "workspace ${ws5}";
"${modifier}+6" = "workspace ${ws6}";
"${modifier}+7" = "workspace ${ws7}";
"${modifier}+8" = "workspace ${ws8}";
"${modifier}+9" = "workspace ${ws9}";
"${modifier}+0" = "workspace ${ws10}";
# Move windows
"${modifier}+Shift+1" = "move container to workspace ${ws1}; workspace ${ws1}";
"${modifier}+Shift+2" = "move container to workspace ${ws2}; workspace ${ws2}";
"${modifier}+Shift+3" = "move container to workspace ${ws3}; workspace ${ws3}";
"${modifier}+Shift+4" = "move container to workspace ${ws4}; workspace ${ws4}";
"${modifier}+Shift+5" = "move container to workspace ${ws5}; workspace ${ws5}";
"${modifier}+Shift+6" = "move container to workspace ${ws6}; workspace ${ws6}";
"${modifier}+Shift+7" = "move container to workspace ${ws7}; workspace ${ws7}";
"${modifier}+Shift+8" = "move container to workspace ${ws8}; workspace ${ws8}";
"${modifier}+Shift+9" = "move container to workspace ${ws9}; workspace ${ws9}";
"${modifier}+Shift+0" = "move container to workspace ${ws10}; workspace ${ws10}";
# Move screens
"${modifier}+Control+l" = "move workspace to output right";
"${modifier}+Control+h" = "move workspace to output left";
# Resizing
"${modifier}+r" = ''mode "resize"'';
"${modifier}+Control+Shift+h" = "resize shrink width 10 px or 10 ppt";
"${modifier}+Control+Shift+j" = "resize grow height 10 px or 10 ppt";
"${modifier}+Control+Shift+k" = "resize shrink height 10 px or 10 ppt";
"${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt";
};
modes = { };
startup = [
{
command = "feh --bg-fill ${config.wallpaper}";
always = true;
notification = false;
}
{
command = "i3-msg workspace ${ws2}, move workspace to output right";
notification = false;
}
{
command = "i3-msg workspace ${ws1}, move workspace to output left";
notification = false;
}
]; ];
"${ws3}" = [{ class = "discord"; }]; window = {
"${ws4}" = [ { class = "steam"; } { class = "Steam"; } ]; border = 0;
}; hideEdgeBorders = "smart";
bars = [{ command = "echo"; }]; # Disable i3bar titlebar = false;
colors = let
background = config.theme.colors.base00;
inactiveBackground = config.theme.colors.base01;
border = config.theme.colors.base01;
inactiveBorder = config.theme.colors.base01;
text = config.theme.colors.base07;
inactiveText = config.theme.colors.base04;
urgentBackground = config.theme.colors.base08;
indicator = "#00000000";
in {
background = config.theme.colors.base00;
focused = {
inherit background indicator text border;
childBorder = background;
};
focusedInactive = {
inherit indicator;
background = inactiveBackground;
border = inactiveBorder;
childBorder = inactiveBackground;
text = inactiveText;
};
# placeholder = { };
unfocused = {
inherit indicator;
background = inactiveBackground;
border = inactiveBorder;
childBorder = inactiveBackground;
text = inactiveText;
};
urgent = {
inherit text indicator;
background = urgentBackground;
border = urgentBackground;
childBorder = urgentBackground;
}; };
workspaceAutoBackAndForth = false;
workspaceOutputAssign = [ ];
# gaps = {
# bottom = 8;
# top = 8;
# left = 8;
# right = 8;
# horizontal = 15;
# vertical = 15;
# inner = 15;
# outer = 0;
# smartBorders = "off";
# smartGaps = false;
# };
}; };
floating.modifier = modifier;
focus = {
mouseWarping = true;
newWindow = "urgent";
followMouse = false;
};
keybindings = {
# Adjust screen brightness
"Shift+F12" =
# Disable dynamic sleep
# https://github.com/rockowitz/ddcutil/issues/323
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"Shift+F11" =
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
"XF86MonBrightnessUp" =
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"XF86MonBrightnessDown" =
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
# Media player controls
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
# Launchers
"${modifier}+Return" =
"exec --no-startup-id kitty; workspace ${ws2}; layout tabbed";
"${modifier}+space" =
"exec --no-startup-id ${config.launcherCommand}";
"${modifier}+Shift+s" =
"exec --no-startup-id ${config.systemdSearch}";
"${modifier}+Shift+a" =
"exec --no-startup-id ${config.audioSwitchCommand}";
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
"${modifier}+Shift+period" =
"exec --no-startup-id ${config.powerCommand}";
"${modifier}+Shift+m" =
"exec --no-startup-id ${config.brightnessCommand}";
"${modifier}+c" =
"exec --no-startup-id ${config.calculatorCommand}";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = ''
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = "exec ${lockCmd}";
"${modifier}+Mod1+h" =
"exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"${modifier}+Mod1+r" =
"exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
# Window options
"${modifier}+q" = "kill";
"${modifier}+b" = "exec ${config.toggleBarCommand}";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
# Tiling
"${modifier}+i" = "split h";
"${modifier}+v" = "split v";
"${modifier}+s" = "layout stacking";
"${modifier}+t" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+Control+space" = "focus mode_toggle";
"${modifier}+a" = "focus parent";
# Workspaces
"${modifier}+1" = "workspace ${ws1}";
"${modifier}+2" = "workspace ${ws2}";
"${modifier}+3" = "workspace ${ws3}";
"${modifier}+4" = "workspace ${ws4}";
"${modifier}+5" = "workspace ${ws5}";
"${modifier}+6" = "workspace ${ws6}";
"${modifier}+7" = "workspace ${ws7}";
"${modifier}+8" = "workspace ${ws8}";
"${modifier}+9" = "workspace ${ws9}";
"${modifier}+0" = "workspace ${ws10}";
# Move windows
"${modifier}+Shift+1" =
"move container to workspace ${ws1}; workspace ${ws1}";
"${modifier}+Shift+2" =
"move container to workspace ${ws2}; workspace ${ws2}";
"${modifier}+Shift+3" =
"move container to workspace ${ws3}; workspace ${ws3}";
"${modifier}+Shift+4" =
"move container to workspace ${ws4}; workspace ${ws4}";
"${modifier}+Shift+5" =
"move container to workspace ${ws5}; workspace ${ws5}";
"${modifier}+Shift+6" =
"move container to workspace ${ws6}; workspace ${ws6}";
"${modifier}+Shift+7" =
"move container to workspace ${ws7}; workspace ${ws7}";
"${modifier}+Shift+8" =
"move container to workspace ${ws8}; workspace ${ws8}";
"${modifier}+Shift+9" =
"move container to workspace ${ws9}; workspace ${ws9}";
"${modifier}+Shift+0" =
"move container to workspace ${ws10}; workspace ${ws10}";
# Move screens
"${modifier}+Control+l" = "move workspace to output right";
"${modifier}+Control+h" = "move workspace to output left";
# Resizing
"${modifier}+r" = ''mode "resize"'';
"${modifier}+Control+Shift+h" =
"resize shrink width 10 px or 10 ppt";
"${modifier}+Control+Shift+j" =
"resize grow height 10 px or 10 ppt";
"${modifier}+Control+Shift+k" =
"resize shrink height 10 px or 10 ppt";
"${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt";
};
modes = { };
startup = [
{
command = "feh --bg-fill ${config.wallpaper}";
always = true;
notification = false;
}
{
command =
"i3-msg workspace ${ws2}, move workspace to output right";
notification = false;
}
{
command =
"i3-msg workspace ${ws1}, move workspace to output left";
notification = false;
}
];
window = {
border = 0;
hideEdgeBorders = "smart";
titlebar = false;
};
workspaceAutoBackAndForth = false;
workspaceOutputAssign = [ ];
# gaps = {
# bottom = 8;
# top = 8;
# left = 8;
# right = 8;
# horizontal = 15;
# vertical = 15;
# inner = 15;
# outer = 0;
# smartBorders = "off";
# smartGaps = false;
# };
};
extraConfig = ""; extraConfig = "";
}; };
@ -266,22 +255,26 @@ in {
# Update lock screen cache only if cache is empty # Update lock screen cache only if cache is empty
home.activation.updateLockScreenCache = home.activation.updateLockScreenCache =
let cacheDir = "${config.homePath}/.cache/betterlockscreen/current"; let
in lib.mkIf config.services.xserver.enable cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
(config.home-manager.users.${config.user}.lib.dag.entryAfter in
[ "writeBoundary" ] '' lib.mkIf config.services.xserver.enable (
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then
$DRY_RUN_CMD ${lockUpdate} $DRY_RUN_CMD ${lockUpdate}
fi fi
''); ''
);
}; };
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service # Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
systemd.services.lock = { systemd.services.lock = {
enable = config.services.xserver.enable; enable = config.services.xserver.enable;
description = "Lock the screen on resume from suspend"; description = "Lock the screen on resume from suspend";
before = [ "sleep.target" "suspend.target" ]; before = [
"sleep.target"
"suspend.target"
];
serviceConfig = { serviceConfig = {
User = config.user; User = config.user;
Type = "simple"; Type = "simple";
@ -290,9 +283,10 @@ in {
ExecStart = lockCmd; ExecStart = lockCmd;
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1"; ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
}; };
wantedBy = [ "sleep.target" "suspend.target" ]; wantedBy = [
"sleep.target"
"suspend.target"
];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
@ -31,18 +37,21 @@
]; ];
shadow = false; shadow = false;
shadowExclude = [ ]; shadowExclude = [ ];
shadowOffsets = [ (-10) (-10) ]; shadowOffsets = [
(-10)
(-10)
];
shadowOpacity = 0.5; shadowOpacity = 0.5;
vSync = true; vSync = true;
}; };
xsession.windowManager.i3.config.startup = [{ xsession.windowManager.i3.config.startup = [
command = "systemctl --user restart picom"; {
always = true; command = "systemctl --user restart picom";
notification = false; always = true;
}]; notification = false;
}
];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
@ -46,33 +52,36 @@
# wm-restack = "i3"; # wm-restack = "i3";
# override-redirect = true; # override-redirect = true;
}; };
"module/i3" = let padding = 2; "module/i3" =
in { let
type = "internal/i3"; padding = 2;
pin-workspaces = false; in
show-urgent = true; {
strip-wsnumbers = true; type = "internal/i3";
index-sort = true; pin-workspaces = false;
enable-click = true; show-urgent = true;
wrapping-scroll = true; strip-wsnumbers = true;
fuzzy-match = true; index-sort = true;
format = "<label-state> <label-mode>"; enable-click = true;
label-focused = "%name%"; wrapping-scroll = true;
label-focused-foreground = config.theme.colors.base01; fuzzy-match = true;
label-focused-background = config.theme.colors.base05; format = "<label-state> <label-mode>";
label-focused-underline = config.theme.colors.base03; label-focused = "%name%";
label-focused-padding = padding; label-focused-foreground = config.theme.colors.base01;
label-unfocused = "%name%"; label-focused-background = config.theme.colors.base05;
label-unfocused-padding = padding; label-focused-underline = config.theme.colors.base03;
label-visible = "%name%"; label-focused-padding = padding;
label-visible-underline = config.theme.colors.base01; label-unfocused = "%name%";
label-visible-padding = padding; label-unfocused-padding = padding;
label-urgent = "%name%"; label-visible = "%name%";
label-urgent-foreground = config.theme.colors.base00; label-visible-underline = config.theme.colors.base01;
label-urgent-background = config.theme.colors.base08; label-visible-padding = padding;
label-urgent-underline = config.theme.colors.base0F; label-urgent = "%name%";
label-urgent-padding = padding; 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" = { "module/xworkspaces" = {
type = "internal/xworkspaces"; type = "internal/xworkspaces";
label-active = "%name%"; label-active = "%name%";
@ -105,24 +114,24 @@
type = "custom/script"; type = "custom/script";
interval = 10; interval = 10;
format = "<label>"; format = "<label>";
exec = builtins.toString (pkgs.writeShellScript "mailcount.sh" '' exec = builtins.toString (
${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null pkgs.writeShellScript "mailcount.sh" ''
UNREAD=$( ${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null
${pkgs.notmuch}/bin/notmuch count \ UNREAD=$(
is:inbox and \ ${pkgs.notmuch}/bin/notmuch count \
is:unread and \ is:inbox and \
folder:main/Inbox \ is:unread and \
2>/dev/null folder:main/Inbox \
) 2>/dev/null
if [ $UNREAD = "0" ]; then )
echo "" if [ $UNREAD = "0" ]; then
else echo ""
echo "%{T2}%{T-} $UNREAD " else
fi 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'"; );
click-left = "i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
}; };
"module/network" = { "module/network" = {
type = "internal/network"; type = "internal/network";
@ -220,13 +229,13 @@
}; };
}; };
xsession.windowManager.i3.config.startup = [{ xsession.windowManager.i3.config.startup = [
command = "pkill polybar; polybar -r main"; {
always = true; command = "pkill polybar; polybar -r main";
notification = false; always = true;
}]; notification = false;
}
];
}; };
}; };
} }

Some files were not shown because too many files have changed in this diff Show More