dotfiles/hm/common.nix

224 lines
6.6 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
2023-10-28 22:09:36 +02:00
{
2024-03-09 18:22:30 +01:00
frogeye.hooks.lock = ''
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
'';
2024-01-11 23:54:03 +01:00
programs = {
home-manager.enable = true;
bat = {
enable = true;
2024-06-01 18:22:50 +02:00
config.style = "full";
2024-01-11 23:54:03 +01:00
};
bash.shellAliases = {
# Replacement commands
# ls = "lsd"; # lsd is suuuper slow for large directories
cat = "bat -pp";
# Completion for existing commands
mkdir = "mkdir -v";
# cp = "cp -i"; # Disabled because conflicts with the ZSH/Bash one. This separation is confusing I swear.
mv = "mv -iv";
free = "free -h";
df = "df -h";
ffmpeg = "ffmpeg -hide_banner";
ffprobe = "ffprobe -hide_banner";
ffplay = "ffplay -hide_banner";
numbat = "numbat --intro-banner off";
insect = "numbat";
# Frequent mistakes
sl = "ls";
al = "la";
mdkir = "mkdir";
systemclt = "systemctl";
please = "sudo";
# Shortcuts for commonly used commands
ll = "lsd -l";
la = "lsd -la";
s = "sudo -s -E";
# Preference
wol = "wakeonlan"; # TODO Really, isn't wol better? Also wtf Arch aliases to pass because neither is installed anyways x)
mutt = "neomutt";
# Bash/Zsh only
cp = "cp -i --reflink=auto";
grep = "grep --color=auto";
dd = "dd status=progress";
rm = "rm -v --one-file-system";
# free = "free -m"; # Disabled because... no? Why?
diff = "diff --color=auto";
dmesg = "dmesg --ctime";
wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts";
# Imported from scripts
rms = ''${pkgs.findutils}/bin/find . -name "*.sync-conflict-*" -delete''; # Remove syncthing conflict files
newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail'';
oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head'';
};
thefuck = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
2024-01-11 23:54:03 +01:00
lsd = {
enable = true;
settings = {
size = "short";
};
2024-01-11 23:54:03 +01:00
colors = {
# Base16 only, so it reuses the current theme.
date = { day-old = 4; hour-old = 6; older = 5; };
git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; };
group = 6;
inode = { invalid = 245; valid = 13; };
links = { invalid = 9; valid = 14; };
permission = { acl = 6; context = 14; exec = 1; exec-sticky = 5; no-access = 245; octal = 6; read = 2; write = 3; };
size = { large = 1; medium = 9; none = 11; small = 3; };
tree-edge = 13;
user = 2;
2023-11-12 22:44:20 +01:00
};
2023-11-05 23:19:04 +01:00
};
2024-01-11 23:54:03 +01:00
dircolors = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
# UPST This thing put stuff in .dircolors when it actually doesn't have to
};
git.enable = true;
gpg.enable = true;
fzf = {
enable = true;
enableZshIntegration = true;
defaultOptions = [ "--height 40%" "--layout=default" ];
fileWidgetOptions = [ "--preview '[[ -d {} ]] && ${pkgs.coreutils}/bin/ls -l --color=always {} || [[ \$(${pkgs.file}/bin/file --mime {}) =~ binary ]] && ${pkgs.file}/bin/file --brief {} || (${pkgs.highlight}/bin/highlight -O ansi -l {} || coderay {} || rougify {} || ${pkgs.coreutils}/bin/cat {}) 2> /dev/null | head -500'" ];
# TODO Above not working... not really used either?
# file and friends are not in PATH by default... so here we want aboslute paths, which means those won't get reloaded. Meh.
};
less.enable = true;
nixvim.enable = true;
readline = {
enable = true;
variables = {
"bell-style" = "none";
"colored-completion-prefix" = true;
"colored-stats" = true;
"completion-ignore-case" = true;
"completion-query-items" = 200;
"editing-mode" = "vi";
"history-preserve-point" = true;
"history-size" = 10000;
"horizontal-scroll-mode" = false;
"mark-directories" = true;
"mark-modified-lines" = false;
"mark-symlinked-directories" = true;
"match-hidden-files" = true;
"menu-complete-display-prefix" = true;
"page-completions" = true;
"print-completions-horizontally" = false;
"revert-all-at-newline" = false;
"show-all-if-ambiguous" = true;
"show-all-if-unmodified" = true;
"show-mode-in-prompt" = true;
"skip-completed-text" = true;
"visible-stats" = false;
2023-11-12 22:44:20 +01:00
};
2024-01-11 23:54:03 +01:00
extraConfig = builtins.readFile ./inputrc;
2023-11-12 22:44:20 +01:00
};
2024-01-11 23:54:03 +01:00
tmux.enable = true;
translate-shell.enable = true; # TODO Cool config?
2023-11-12 22:44:20 +01:00
};
2023-11-05 21:32:31 +01:00
home = {
2023-12-22 14:57:44 +01:00
activation = {
# Prevent Virtualbox from creating a "VirtualBox VMs" folder in $HOME
setVirtualboxSettings = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if command -v VBoxManage > /dev/null
then
VBoxManage setproperty machinefolder ${config.xdg.dataHome}/virtualbox
fi
'';
};
stateVersion = "24.05";
2023-11-05 21:32:31 +01:00
packages = with pkgs; [
2024-01-07 23:41:35 +01:00
# Terminal utils
2023-11-05 21:32:31 +01:00
coreutils
2024-01-07 23:41:35 +01:00
moreutils
rename
which
file
# Pipe utils
2023-11-05 21:32:31 +01:00
gnugrep
gnused
2024-01-07 23:41:35 +01:00
gawk
# Extraction
2023-11-05 21:32:31 +01:00
gnutar
2024-01-07 23:41:35 +01:00
unzip
unrar
p7zip
2023-10-28 22:09:36 +02:00
2024-01-07 23:41:35 +01:00
# Documentation
man
tldr
2023-12-23 00:15:56 +01:00
neofetch
2023-10-28 22:09:36 +02:00
2023-11-05 21:32:31 +01:00
# remote
2024-01-07 23:41:35 +01:00
wget
curl
openssl
2023-11-05 21:32:31 +01:00
openssh
rsync
borgbackup
2024-04-24 13:25:59 +02:00
sshfs
2023-10-28 22:09:36 +02:00
2023-11-05 21:32:31 +01:00
# cleanup
ncdu
jdupes
duperemove
2024-01-07 12:54:43 +01:00
compsize
2024-02-03 19:40:06 +01:00
btdu
2023-10-28 22:09:36 +02:00
2024-01-04 23:18:06 +01:00
# toolbox
2023-11-05 21:32:31 +01:00
imagemagick
2024-01-04 23:18:06 +01:00
numbat
2024-03-09 19:09:30 +01:00
2024-04-24 13:25:59 +02:00
# hardware
pciutils
usbutils
dmidecode
lshw
labelle # Label printer
2024-04-24 13:25:59 +02:00
2024-03-09 19:09:30 +01:00
# Locker
(pkgs.writeShellApplication {
name = "lock";
text = ''
${config.frogeye.hooks.lock}
${pkgs.vlock}/bin/vlock --all
'';
})
2023-11-05 21:32:31 +01:00
];
2023-11-07 23:17:40 +01:00
sessionVariables = {
# Favourite commands
2023-11-22 14:05:48 +01:00
# Extra config
2023-11-08 12:23:30 +01:00
# INPUTRC = "${config.xdg.configHome}/inputrc"; # UPST Will use programs.readline, but doesn't allow path setting
2023-11-07 23:17:40 +01:00
SQLITE_HISTFILE = "${config.xdg.stateHome}/sqlite_history";
2023-11-22 14:05:48 +01:00
2024-01-11 23:54:03 +01:00
# Bash/ZSH only?
TIME_STYLE = "+%Y-%m-%d %H:%M:%S";
# Fzf
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
2024-01-08 22:59:06 +01:00
};
2023-11-07 23:17:40 +01:00
sessionPath = [
"${config.home.homeDirectory}/.local/bin"
2024-01-10 13:55:15 +01:00
"${config.home.homeDirectory}/.config/dotfiles/hm/scripts" # Not Nix path otherwise it gets converted into store,
# and then every time you want to modify a script you have to rebuild and re-login...
2023-11-07 23:17:40 +01:00
];
2023-11-05 21:32:31 +01:00
};
2023-10-28 22:09:36 +02:00
}