refactor: major structural changes

git updates

update tmux conf

add ansible tools

squash me

squash

fix: get git aliases from plugin

virt stuff

add devenv

some virt updates

kubernetes
This commit is contained in:
Glen Goodwin 2023-11-22 16:33:30 -05:00
parent 2e8c1eec90
commit 2220c4e917
87 changed files with 1963 additions and 2261 deletions

View file

@ -0,0 +1,111 @@
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
# You can import other home-manager modules here
imports = [
# If you want to use modules your own flake exports (from modules/home-manager):
# outputs.homeManagerModules.example
# Or modules exported from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModules.default
# You can also split up your configuration and import pieces of it here:
# ./nvim.nix
../modules/common.nix
../modules/hyprland.nix
../modules/common-gui.nix
../modules/linux-gui.nix
../modules/devenv.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
(final: prev: {
neovim = inputs.neovim-config.packages."x86_64-linux".default;
})
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
};
home = {
username = "gwg313";
homeDirectory = "/home/gwg313";
};
stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/tokyo-night-terminal-storm.yaml";
image = ./wallpaper.jpg;
autoEnable = true;
opacity.terminal = 1.0;
fonts.sizes.terminal = 15;
fonts = {
serif = {
package = pkgs.meslo-lgs-nf;
name = "MesloLGS NF";
};
sansSerif = {
package = pkgs.meslo-lgs-nf;
name = "MesloLGS NF";
};
monospace = {
package = pkgs.ibm-plex;
name = "IBM Plex Mono";
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 20;
};
};
# Add stuff for your user as you see fit:
# programs.neovim.enable = true;
# home.packages = with pkgs; [ steam ];
# Enable home-manager and git
programs.home-manager.enable = true;
programs.git.enable = true;
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "23.05";
}

View file

@ -0,0 +1,107 @@
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
# You can import other home-manager modules here
imports = [
# If you want to use modules your own flake exports (from modules/home-manager):
# outputs.homeManagerModules.example
# Or modules exported from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModules.default
# You can also split up your configuration and import pieces of it here:
# ./nvim.nix
../modules/common.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
(final: prev: {
neovim = inputs.neovim-config.packages."x86_64-linux".default;
})
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
};
home = {
username = "gwg313";
homeDirectory = "/home/gwg313";
};
stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/tokyo-night-terminal-storm.yaml";
image = ./wallpaper.jpg;
autoEnable = true;
opacity.terminal = 1.0;
fonts.sizes.terminal = 15;
fonts = {
serif = {
package = pkgs.meslo-lgs-nf;
name = "MesloLGS NF";
};
sansSerif = {
package = pkgs.meslo-lgs-nf;
name = "MesloLGS NF";
};
monospace = {
package = pkgs.ibm-plex;
name = "IBM Plex Mono";
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 20;
};
};
# Add stuff for your user as you see fit:
# programs.neovim.enable = true;
# home.packages = with pkgs; [ steam ];
# Enable home-manager and git
programs.home-manager.enable = true;
programs.git.enable = true;
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "23.05";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -0,0 +1,9 @@
# A fast, GPU-accelerated terminal emulator.
{...}: {
programs.alacritty = {
enable = true;
settings = {
env = {TERM = "xterm-256color";};
};
};
}

View file

@ -0,0 +1,12 @@
{
config,
lib,
pkgs,
...
}: {
home.packages = with pkgs; [
ansible
ansible-later
ansible-doctor
];
}

View file

@ -0,0 +1,9 @@
# ✨ Magical shell history
{...}: {
programs.atuin = {
enable = true;
flags = [
"--disable-up-arrow"
];
};
}

View file

@ -0,0 +1,6 @@
# A cat clone with syntax highlighting and Git integration.
{...}: {
programs.bat = {
enable = true;
};
}

View file

@ -0,0 +1,7 @@
# An interactive treeview directory navigator
{...}: {
programs.broot = {
enable = true;
enableZshIntegration = true;
};
}

View file

@ -0,0 +1,20 @@
{pkgs, ...}: {
imports = [
./alacritty.nix
./fuzzel.nix
];
fonts.fontconfig.enable = true;
# Bluetooth power alerts
services.poweralertd.enable = true;
home.packages = with pkgs; [
# fonts
rPackages.fontawesome
nerdfonts
ubuntu_font_family
noto-fonts-cjk-sans
yt-dlp
];
}

View file

@ -0,0 +1,93 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./git.nix
./tmux/tmux.nix
./zsh.nix
./starship.nix
./atuin.nix
./bat.nix
./broot.nix
./eza.nix
];
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs;
[
# Editors
vim # Highly configurable text editor popular for efficiency and extensibility.
neovim # Improved version of vim, often used with overlays.
# Builtin Replacements
htop # Modern and interactive process viewer, an improved alternative to 'top.'
bottom # Similar to 'htop,' providing a top-like interface with additional features.
colordiff # Tool to colorize 'diff' output, making differences between files easier to spot.
du-dust # Modern replacement for 'du,' offering intuitive and visually appealing disk usage analysis.
eza # Modern replacement for 'ls' with additional features and a user-friendly interface.
fd # Faster and user-friendly alternative to 'find' for searching and locating files.
ripgrep # Faster alternative to 'grep,' recursively searching directories for a regex pattern.
thefuck # Handy tool that corrects mistyped console commands.
zoxide # Faster alternative to 'cd' for quick and efficient navigation.
fzf # Fuzzy finder for rapid file and directory searches.
tealdeer # Command-line utility providing simplified and community-driven man pages.
viddy # A modern watch command. Time machine and pager etc.
moar # A syntax highlighting pager
# Multiplexers
tmate # Terminal multiplexer allowing multiple users to access a single session.
# Misc Tools
tree # Displays directory structure in a tree-like format.
p7zip # Command-line tool for handling 7z compressed files.
yt-dlp # Fork of youtube-dl, facilitating video downloads from various sites.
mkvtoolnix # Set of tools to create, alter, and inspect Matroska files (MKV).
hyperfine # Command-line benchmarking tool.
unzip # Command-line tool for extracting files from ZIP archives.
# TUI Apps
#ncdu_2
# Networking
gping # Ping with TUI for a visual representation of network connectivity.
iperf # Tool for measuring maximum TCP and UDP bandwidth performance.
nmap # Network scanning tool for discovering hosts and services.
wget # Command-line utility for downloading files from the web.
speedtest-cli # Command-line interface for testing internet bandwidth.
rsync # Fast and versatile file copying and synchronization tool.
dig # A command-line tool for querying DNS name servers, providing detailed information about domain names, IP addresses, and DNS records.
picocom # Minimal terminal emulator for microcontrollers.
# Docs
pandoc # Document converter transforming files between markup formats.
gnumake # GNU make tool, a build automation tool for compiling projects.
# Useful Utils
grex # Tool generating regular expressions from user-provided test cases.
git-cliff # Tool for visualizing project commit history and generating release notes.
# Nix Tools
nix-prefetch-github # Tool for fetching the latest version and hash of a GitHub repository.
direnv # Environment switcher for the shell.
nix-direnv # Integration of direnv with the Nix package manager.
alejandra # Nix code formatter.
nix-init # Simplifies the process of creating Nix projects.
]
++ lib.optionals stdenv.isDarwin [
coreutils # Essential GNU core utilities, including `dd` with the `--status=progress` option for more informative progress reporting.
wifi-password # Command-line tool to quickly retrieve the current Wi-Fi password, simplifying access to network credentials.
time # GNU time command, providing more detailed and accurate information about the resource usage of a command or process.
]
++ lib.optionals stdenv.isLinux [
iputils # Package providing essential network utilities such as `ping` and `ifconfig` for network diagnostics and configuration.
libuuid # Library for generating universally unique identifiers (UUIDs), with the `uuidgen` utility included. (Note: Already pre-installed on macOS.)
iotop # Disk I/O monitoring tool that provides a top-like interface to showcase real-time disk activity and identify performance bottlenecks.
iftop # Network monitoring tool that displays a real-time, interactive view of network bandwidth usage by different connections.
bmon # Bandwidth monitoring tool that visually represents network usage with a simple and easy-to-read interface.
bandwhich # Network bandwidth monitor that identifies and displays bandwidth usage per process, helping to pinpoint data-hungry applications.
];
}

View file

@ -0,0 +1,15 @@
{
config,
lib,
pkgs,
inputs,
...
}: {
home.packages = with pkgs; [
cachix
inputs.devenv.packages.${system}.devenv
];
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
}

View file

@ -0,0 +1,45 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.programs.discord;
discordPatcherBin = pkgs.writers.writePython3Bin "discord-krisp-patcher" {
libraries = with pkgs.python3Packages; [pyelftools capstone];
flakeIgnore = [
"E265" # from nix-shell shebang
"E501" # line too long (82 > 79 characters)
"F403" # 'from module import *' used; unable to detect undefined names
"F405" # name may be undefined, or defined from star imports: module
];
} (builtins.readFile ./krisp-patcher.py);
wrapDiscordBinary = pkgs.writeShellScriptBin "discord" ''
${pkgs.findutils}/bin/find -L $HOME/.config/discord -name 'discord_krisp.node' -exec ${discordPatcherBin}/bin/discord-krisp-patcher {} +
${pkgs.discord}/bin/discord "$@"
'';
discord = pkgs.discord.override {
# Performance mod
withOpenASAR = true;
# link fix
nss = pkgs.nss_latest;
};
in {
options.programs.discord = {
enable = lib.mkEnableOption "Discord";
wrapDiscord = lib.mkEnableOption "wrap the Discord binary with a patching each time";
};
config = lib.mkIf cfg.enable {
home.packages =
[discordPatcherBin]
++ (
if cfg.wrapDiscord
then [wrapDiscordBinary]
else [pkgs.discord]
);
};
}

View file

@ -0,0 +1,83 @@
import sys
import shutil
from elftools.elf.elffile import ELFFile
from capstone import *
from capstone.x86 import *
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} [path to discord_krisp.node]")
# "Unix programs generally use 2 for command line syntax errors and 1 for all other kind of errors."
sys.exit(2)
executable = sys.argv[1]
elf = ELFFile(open(executable, "rb"))
symtab = elf.get_section_by_name('.symtab')
krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[0].entry.st_value
isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value
text = elf.get_section_by_name('.text')
text_start = text['sh_addr']
text_start_file = text['sh_offset']
# This seems to always be zero (.text starts at the right offset in the file). Do it just in case?
address_to_file = text_start_file - text_start
# Done with the ELF now.
# elf.close()
krisp_initialize_offset = krisp_initialize_address - address_to_file
isSignedByDiscord_offset = krisp_initialize_address - address_to_file
f = open(executable, "rb")
f.seek(krisp_initialize_offset)
krisp_initialize = f.read(64)
f.close()
# States
found_issigned_by_discord_call = False
found_issigned_by_discord_test = False
found_issigned_by_discord_je = False
found_already_patched = False
je_location = None
# We are looking for a call to IsSignedByDiscord, followed by a test, followed by a je.
# Then we patch the je into a two byte nop.
md = Cs(CS_ARCH_X86, CS_MODE_64)
md.detail = True
for i in md.disasm(krisp_initialize, krisp_initialize_address):
if i.id == X86_INS_CALL:
if i.operands[0].type == X86_OP_IMM:
if i.operands[0].imm == isSignedByDiscord_address:
found_issigned_by_discord_call = True
if i.id == X86_INS_TEST:
if found_issigned_by_discord_call:
found_issigned_by_discord_test = True
if i.id == X86_INS_JE:
if found_issigned_by_discord_test:
found_issigned_by_discord_je = True
je_location = i.address
break
if i.id == X86_INS_NOP:
if found_issigned_by_discord_test:
found_already_patched = True
break
if je_location:
print(f"Found patch location: 0x{je_location:x}")
shutil.copyfile(executable, executable + ".orig")
f = open(executable, 'rb+')
f.seek(je_location - address_to_file)
f.write(b'\x66\x90') # Two byte NOP
f.close()
else:
if found_already_patched:
print("Couldn't find patch location - already patched.")
else:
print("Couldn't find patch location - review manually. Sorry.")

View file

@ -0,0 +1,9 @@
# A modern replacement for 'ls'.
{...}: {
programs.eza = {
enable = true;
enableAliases = true;
git = true;
icons = true;
};
}

View file

@ -0,0 +1,6 @@
# Application launcher for wlroots based Wayland compositors, similar to rofi's `drun` mode.
{...}: {
programs.fuzzel = {
enable = true;
};
}

View file

@ -0,0 +1,67 @@
{
config,
lib,
pkgs,
user,
...
}: {
programs.git = {
enable = true;
userName = "Glen Goodwin";
userEmail = "glen.goodwin1992@gmail.com";
extraConfig = {
diff = {
algorithm = "patience";
compactionHeuristic = "true";
tool = "nvimdiff";
};
"difftool \"nvimdiff\"" = {
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\" -c \"wincmd w\" -c \"wincmd L\"";
};
merge = {
tool = "nvimdiff4";
prompt = "false";
};
"mergetool \"nvimdiff4\"" = {
cmd = "nvim -d $LOCAL $BASE $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'";
};
init = {
defaultBranch = "main";
};
core = {
pager = "delta";
editor = "nvim";
};
delta = {
features = "side-by-side line-numbers decorations";
navigate = "true";
whitespace-error-style = "22 reverse";
};
interactive = {
diffFilter = "delta --color-only";
};
};
ignores = [
"__pycache__"
".direnv"
# Node
"npm-debug.log"
"*.swp"
];
};
programs.zsh = {
shellAliases = {
trackme = "git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD)";
rebasemain = "git pull origin main --rebase";
};
};
home.packages = with pkgs; [
cocogitto
delta
lazygit
gh
pre-commit
];
}

View file

@ -0,0 +1,231 @@
{
config,
pkgs,
...
}: {
imports = [
./waybar.nix
];
services.mako = {
enable = true;
defaultTimeout = 4000;
borderRadius = 5;
borderSize = 2;
layer = "overlay";
};
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = {
xwayland.force_zero_scaling = true;
input = {
sensitivity = 0.4;
# todo custom
accel_profile = "adaptive";
# accel_profile = "custom 20000 0.755 0.05 0.855 0.06";
touchpad = {
natural_scroll = true;
scroll_factor = 0.38;
tap-and-drag = true;
middle_button_emulation = true;
tap-to-click = true;
};
};
device.at-translated-set-2-keyboard = {
kb_layout = "us";
kb_options = "caps:ctrl_modifier";
numlock_by_default = 1;
};
general = {
gaps_in = 5;
gaps_out = 16;
resize_on_border = true;
hover_icon_on_border = false;
layout = "dwindle";
};
master = {
new_is_master = false;
smart_resizing = false;
};
dwindle = {
force_split = 2;
preserve_split = true;
};
decoration = {
rounding = 5;
active_opacity = 0.93;
inactive_opacity = 0.93;
fullscreen_opacity = 1;
drop_shadow = false;
};
animations = {
enabled = true;
bezier = [
"myBezier, 0.22, 1, 0.36, 1"
"snap, 0, 1, 0, 1"
];
animation = [
"windows, 1, 7, myBezier"
"windowsOut, 1, 3, default, popin 60%"
"border, 1, 0.5, snap"
"borderangle, 1, 0.5, snap"
"fade, 1, 0.001, myBezier"
"workspaces, 1, 0.8, myBezier, fade"
];
};
# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures = {
workspace_swipe = true;
workspace_swipe_fingers = 3;
workspace_swipe_cancel_ratio = 0.6;
workspace_swipe_min_speed_to_force = 30;
workspace_swipe_distance = 2000;
workspace_swipe_invert = true;
};
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
force_default_wallpaper = 0;
mouse_move_enables_dpms = true;
key_press_enables_dpms = true;
};
"$mod" = "SUPER";
bind = [
# general binds
"$mod, RETURN, exec, ${pkgs.alacritty}/bin/alacritty"
"$mod, Q, killactive"
"SUPER_SHIFT, Q, exec, ${pkgs.wlogout}/bin/wlogout"
"$mod, SPACE, exec, pkill fuzzel || ${pkgs.fuzzel}/bin/fuzzel" # pkill or allows for toggle
"SUPER_SHIFT, SPACE, togglefloating"
"$mod, F, fullscreen"
"$mod, L, exec, ${pkgs.swaylock-effects}/bin/swaylock -f"
"$mod, B, exec, ${pkgs.grim}/bin/grim \"desktop-$(${pkgs.busybox}/bin/date +\"%Y%m%d%H%m\").png"
"SUPER_SHIFT, B, exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp -d)\" - | ${pkgs.wl-clipboard}/bin/wl-copy" # Screenshot selection directly to clipboard
# Volume
",XF86AudioRaiseVolume, exec, ${pkgs.ponymix}/bin/ponymix inc 2"
",XF86AudioLowerVolume, exec, ${pkgs.ponymix}/bin/ponymix dec 2"
",XF86AudioMute, exec, ${pkgs.ponymix}/bin/ponymix, toggle"
# Screen Brightness
",XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 10"
",XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -U 10"
# move focus
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
"$mod,right,workspace,+1"
"$mod,left,workspace,-1"
# workspace switching
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
# move window to workspace
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
# Scroll through workspaces
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
];
bindm = [
# mouse movements
"$mod, mouse:272, movewindow"
"$mod_ALT, mouse:273, resizewindow"
"$mod_ALT, mouse:272, resizewindow"
];
monitor = [",preferred,auto,1"];
exec = [
"${pkgs.swaybg}/bin/swaybg -i ${config.stylix.image} -m fill"
];
exec-once = [
# Enables clipboard sync
"${pkgs.wl-clipboard}/bin/wl-paste -p | ${pkgs.wl-clipboard}/bin/wl-copy"
"${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.wl-clipboard}/bin/wl-copy -p"
];
};
wayland.windowManager.hyprland.extraConfig = ''
# will switch to a submap called resize
bind=$mod,R,submap,resize
# will start a submap called "resize"
submap=resize
# sets repeatable binds for resizing the active window
binde=,right,resizeactive,10 0
binde=,left,resizeactive,-10 0
binde=,up,resizeactive,0 -10
binde=,down,resizeactive,0 10
# use reset to go back to the global submap
bind=,escape,submap,reset
# will reset the submap, meaning end the current one and return to the global one
submap=reset
'';
services.swayidle = {
enable = true;
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock -f";
}
{
event = "lock";
command = "lock";
}
];
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock}/bin/swaylock -f";
}
];
systemdTarget = "xdg-desktop-portal-hyprland.service";
};
programs.swaylock = {
enable = true;
settings = {
font-size = "24";
indicator-idle-visible = false;
indicator-radius = 100;
indicator-thickness = 20;
show-failed-attempts = true;
};
};
}

View file

@ -0,0 +1,6 @@
# A terminal-based Kubernetes CLI.
{...}: {
programs.k9s = {
enable = true;
};
}

View file

@ -0,0 +1,6 @@
# A terminal-based Git interface.
{...}: {
programs.lazygit = {
enable = true;
};
}

View file

@ -0,0 +1,24 @@
{pkgs, ...}: {
imports = [
./discord
./zathura.nix
];
programs.discord = {
enable = true;
wrapDiscord = true;
};
home.packages = with pkgs; [
betterdiscordctl # A utility for managing BetterDiscord, enhancing features and customization in the Discord desktop client.
gimp # GNU Image Manipulation Program, a powerful and open-source raster graphics editor for tasks like photo editing and graphic design.
gparted # Gnome Partition Editor, a graphical partition manager for creating, resizing, and managing disk partitions.
kodi # An open-source media center, providing a versatile platform for streaming and organizing media content.
pavucontrol # PulseAudio Volume Control, a feature-rich GUI for controlling and configuring the PulseAudio sound system.
schildichat-desktop-wayland # A desktop client for SchildiChat, designed to work with the Wayland display server.
sublime-music # A modern and feature-rich music player with a clean user interface and advanced playback options.
thunderbird # Mozilla Thunderbird, a powerful and customizable email client with integrated calendaring and chat features.
kicad # An open-source electronic design automation (EDA) suite for creating schematics, PCB layouts, and 3D models.
wireshark # Open-source network protocol analyzer for real-time packet inspection and analysis.
];
}

View file

@ -0,0 +1,17 @@
# A customizable prompt for shells.
{...}: {
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = true;
character = {
success_symbol = "";
error_symbol = "";
};
aws = {
disabled = true;
};
};
};
}

View file

@ -0,0 +1,77 @@
#!/bin/bash
not_in_tmux() {
[ -z "$TMUX" ]
}
DIR="$1"
# If no arguments are passed in, try to immediately attach or start without further input
echo "$DIR"
if [ -z "$DIR" ]; then
if not_in_tmux; then
tmux attach && exit 1 || DIR="--start"
else
exit 1
fi
fi
# If --start was passed in, immediately start a new session based on the current directory
if [ "$DIR" = "--start" ]; then
echo "Starting"
path_name="$(basename "$PWD" | tr . -)"
session_name="${path_name//./_}"
else
# Ask the user which directory to start in
_session_name=$(cd "$DIR" && find -L . -maxdepth 1 -type d -printf "%f\n" | sed "s|/||g" | fzf --reverse --header="Select project from $(basename "$DIR")")
session_name="${_session_name//./_}"
path_name="$DIR/$_session_name"
fi
echo "Session name is \"$session_name\""
echo "Path name is \"$path_name\""
if [ -z "$session_name" ]; then
# Operation cancelled by user
exit 1
fi
session_exists() {
# Check if the $session_name exists
tmux has-session -t "=$session_name"
}
create_detached_session() {
if [ "$DIR" = "--start" ]; then
(TMUX=''
tmux new-session -Ad -s "$session_name" -c "$path_name"
)
else
(TMUX=''
tmux new-session -Ad -s "$session_name" -c "$path_name"
# tmux split-window -vb -t "$session_name" -c "$path_name" -p 70
tmux send-keys -t "$session_name" "nvim '+Telescope find_files'" Enter
)
fi
}
create_if_needed_and_attach() {
if not_in_tmux; then
tmux new-session -As "$session_name" -c "$path_name"
else
if ! session_exists; then
create_detached_session
fi
tmux switch-client -t "$session_name"
fi
}
attach_to_first_session() {
first_session_name=$(tmux list-sessions -F "#{session_name}" | head -n 1)
if [ -n "$first_session_name" ]; then
tmux attach -t "$first_session_name"
tmux choose-tree -Za
fi
}
create_if_needed_and_attach || attach_to_first_session

View file

@ -0,0 +1,166 @@
{
pkgs,
config,
user,
...
}: {
stylix.targets.tmux.enable = false;
programs.tmux = {
enable = true;
clock24 = true;
plugins = with pkgs.tmuxPlugins; [
sensible
yank
resurrect
continuum
vim-tmux-navigator
tmux-thumbs
];
extraConfig = ''
bind -n M-r source-file ~/.config/tmux/tmux.conf
set -ag terminal-overrides ",xterm-256color:RGB"
set -g detach-on-destroy off # don't exit from tmux when closing a session
# New Theme
set -g status-interval 3 # update the status bar every 3 seconds
set -g status-left "#[fg=blue,bold,bg=#${config.lib.stylix.colors.base00}]#S "
set -g status-right "#[fg=#${config.lib.stylix.colors.base07},bold,bg=#${config.lib.stylix.colors.base00}]%a %Y-%m-%d 󱑒 %l:%M %p"
set -ga status-right "#($HOME/.config/tmux/scripts/cal.sh)"
set -g status-justify left
set -g status-left-length 200 # increase length (from 10)
set -g status-right-length 200 # increase length (from 10)
set -g status-position top # macOS / darwin style
set -g status-style 'bg=#${config.lib.stylix.colors.base00}' # transparent
set -g window-status-current-format '#[fg=magenta,bg=#${config.lib.stylix.colors.base00}]#I #W#{?window_zoomed_flag,(),} '
set -g window-status-format '#[fg=gray,bg=#${config.lib.stylix.colors.base00}] #I #W'
set -g window-status-last-style 'fg=white,bg=black'
set -g message-command-style bg=default,fg=yellow
set -g message-style bg=default,fg=yellow
set -g mode-style bg=default,fg=yellow
set -g pane-active-border-style 'fg=magenta,bg=default'
set -g pane-border-style 'fg=brightblack,bg=default'
set -g @tmux-last-prompt-pattern ' '
set -g mouse on
set-option -g status-position top
bind-key g display-popup -h 95% -w 95% -E 'lazygit'
bind-key t display-popup -h 95% -w 95% -E "${pkgs.htop}/bin/htop"
bind C-g display-popup -E "tat ~/gallery"
bind -n M-g display-popup -E "tmux new-session -A -s scratch"
bind -n M-b switch-client -l
bind -n M-p previous-window # for ansi
bind -n M-n next-window # for ansi
bind -n M-P switch-client -p
bind -n M-N switch-client -n
unbind f
bind f resize-pane -Z
# create session
bind C-c new-session
# split current window horizontally
bind - split-window -v
# split current window vertically
bind _ split-window -h
# Select Layouts
#―――――――――――――――――
bind -n M-a select-layout main-vertical
bind -n M-A select-layout main-horizontal
bind -n M-E select-layout even-vertical
bind -n M-V select-layout even-horizontal
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
bind -r c-f resize-pane -Z
# window navigation
# unbind n
# unbind p
setw -g mode-keys vi
bind Enter copy-mode # enter copy mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi C-v send -X rectangle-toggle
bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi Escape send -X cancel
bind -T copy-mode-vi H send -X start-of-line
bind -T copy-mode-vi L send -X end-of-line
# -- buffers -------------------------------------------------------------------
bind b list-buffers # list paste buffers
#bind p paste-buffer -p # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
# -- display -------------------------------------------------------------------
set -g renumber-windows on # renumber windows when a window is closed
bind k display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
fzf --reverse -m --header=kill-session |\
xargs -I {} tmux kill-session -t {}"
bind C-j display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\
xargs tmux switch-client -t"
'';
};
programs.tmate = {
enable = true;
};
home.packages = [
# Open tmux for current project.
(pkgs.writeShellApplication {
name = "tat";
runtimeInputs = [pkgs.tmux pkgs.fzf];
text = builtins.readFile ./ta.sh;
})
pkgs.fzf
];
programs.zsh = {
shellAliases = {
tx = "tmux new -s default";
ta = "tmux attach -t";
tad = "tmux attach -d -t";
ts = "tmux new-session -s";
tl = "tmux list-sessions";
tksv = "tmux kill-server";
tkss = "tmux kill-session -t";
};
};
}

View file

@ -0,0 +1,107 @@
# A highly customizable status bar for Sway and other Wayland-based compositors.
{pkgs, ...}: let
networkInterface.eth = "wlp3s0";
hwmon = "/sys/class/hwmon/hwmon0/temp1_input";
in {
programs.waybar.enable = true;
programs.waybar.settings = {
mainBar = {
layer = "bottom";
position = "top";
height = 24;
modules-left = ["hyprland/workspaces" "sway/mode" "wlr/taskbar"];
modules-center = ["hyprland/window" "gamemode"];
modules-right = ["network" "pulseaudio" "cpu" "custom/cpu_freq" "temperature" "memory" "battery" "tray" "clock"];
"hyprland/workspaces".sort-by-number = true;
"tray"."spacing" = 2;
"sway/mode" = {
format = "<span style=\"italic\">{}</span>";
};
"clock" = {
format = " {:%a %b %d %R}";
};
"cpu" = {
"interval" = 2;
"format" = "{usage}% ";
};
"custom/cpu_freq" = {
format = "{}MHz ";
interval = 5;
exec =
pkgs.writeShellScript "cpuFreq"
''
${pkgs.busybox}/bin/cat /proc/cpuinfo | \
${pkgs.busybox}/bin/grep MHz | \
${pkgs.busybox}/bin/cut -c 12-15 | \
${pkgs.busybox}/bin/tr '\n' ' ' | \
${pkgs.busybox}/bin/awk '{s+=$1}END{print "",s/NR}' RS=" " | \
${pkgs.busybox}/bin/cut -c 2-5
'';
};
"battery" = {
"bat" = "BAT0";
"states" = {
"good" = 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{capacity}% {icon} ";
"format-full" = "";
"format-icons" = ["" "" "" "" ""];
};
"memory"."format" = "{used:0.1f}G/{total:0.1f}G ";
"network" = {
"interface" = "${networkInterface.eth}";
"interval" = 2;
"format-ethernet" = "Up: {bandwidthUpBits} Down: {bandwidthDownBits} ";
"tooltip-format-ethernet" = "{ifname} ";
"format-wifi" = "Up: {bandwidthUpBits} Down: {bandwidthDownBits} {essid} ({signalStrength}%) ";
"tooltip-format-wifi" = "{ifname} {essid} ({signalStrength}%) ";
"format-disconnected" = "Disconnected ";
};
"pulseaudio" = {
"format" = "{volume}% {icon} ";
"format-bluetooth" = "{volume}% {icon} ";
"format-muted" = "";
"format-icons" = {
"headphones" = "";
"handsfree" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = ["" ""];
};
"on-click" = "pavucontrol";
};
"temperature" = {
"hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
"format" = "{}°C";
"critical-threshold" = 80;
};
"gamemode" = {
"format" = "{glyph}";
"format-alt" = "{glyph} {count}";
"glyph" = "";
"hide-not-running" = true;
"use-icon" = true;
"icon-name" = "input-gaming-symbolic";
"icon-spacing" = 4;
"icon-size" = 20;
"tooltip" = true;
"tooltip-format" = "Games running: {count}";
};
};
};
}

View file

@ -0,0 +1,14 @@
# A highly customizable document viewer.
{
pkgs,
config,
...
}: {
programs.zathura = {
enable = true;
extraConfig = ''
# Open document in fit-width mode by default
set adjust-open "best-fit"
'';
};
}

View file

@ -0,0 +1,76 @@
{
config,
lib,
pkgs,
user,
...
}: {
programs.zsh = {
enable = true;
shellAliases = {
update = "sudo nixos-rebuild switch";
clean = "nix-collect-garbage -d";
reload = "source ~/.zshrc";
"." = "cd ../";
".." = "cd ../../";
"..." = "cd ../../../";
"...." = "cd ../../../../";
ps = "procs";
grep = "rg";
cat = "bat";
vim = "nvim";
# Default flags
rm = "rm -i";
chmod = "chmod -R";
cp = "cp -R -i -v";
mv = "mv -i -v";
mkdir = "mkdir -p -v";
df = "df -h";
du = "du -h -s";
dd = "dd status=progress bs=4M conv=fdatasync ";
wgetpaste = "wgetpaste -Xx";
sudo = "sudo "; # Makes sudo work with es
ssh = "TERM=xterm ssh"; # Fixes some issues with ssh on some terminals
wget = "wget -c";
ping = "ping -c 5";
# Misc alieses I use often
ports = "netstat -tulanp";
rmd = "rm -rf";
mine = "sudo chown -R $(whoami):users";
benchmark = "hyperfine --warmup 3 ";
c = "clear";
listen = "lsof -P -i -n";
tra = "transmission-remote -a";
clock = "sudo ntpd -gq";
octal = "stat -c '%a %n'";
};
zplug = {
enable = true;
plugins = [
{name = "zsh-users/zsh-autosuggestions";}
{name = "zsh-users/zsh-completions";}
{name = "zsh-users/zsh-syntax-highlighting";}
{name = "MichaelAquilina/zsh-you-should-use";}
];
};
oh-my-zsh = {
enable = true;
plugins = ["git"];
theme = "robbyrussell";
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
initExtra = ''
'';
};
}