{ pkgs, lib, ... }: let isDarwin = lib.strings.hasSuffix "darwin" pkgs.system; in { environment.systemPackages = [ pkgs.htop pkgs.btop pkgs.iftop pkgs.lsof pkgs.wget pkgs.curl pkgs.zip pkgs.unzip pkgs.unrar pkgs.p7zip pkgs.fd pkgs.ripgrep pkgs.bat pkgs.findutils pkgs.coreutils pkgs.tree pkgs.rlwrap pkgs.file pkgs.progress pkgs.gdu pkgs.rmlint pkgs.binutils # for objdump, strings, etc. pkgs.gnumake # for make pkgs.tokei # for code statistics pkgs.man-pages pkgs.man-pages-posix pkgs.dos2unix pkgs.whois pkgs.dnsutils pkgs.aria2 pkgs.jq pkgs.yq pkgs.bc pkgs.vimv pkgs.pciutils # for lspci pkgs.tmux ] ++ lib.optionals (!isDarwin) [ pkgs.usbutils # for lsusb pkgs.lshw pkgs.iotop pkgs.psmisc # killall, pstree ]; security.wrappers = { pmount = { setuid = true; owner = "root"; group = "root"; source = "${pkgs.pmount}/bin/pmount"; }; pumount = { setuid = true; owner = "root"; group = "root"; source = "${pkgs.pmount}/bin/pumount"; }; }; environment.interactiveShellInit = '' # Use XDG_RUNTIME_DIR for temporary files if available if [ -d "$XDG_RUNTIME_DIR" ]; then export TMPDIR="$XDG_RUNTIME_DIR" fi ''; environment.shellAliases = let take = pkgs.writers.writeDash "take" '' mkdir "$1" && cd "$1" ''; cdt = pkgs.writers.writeDash "cdt" '' cd $(mktemp -p "$XDG_RUNTIME_DIR" -d "cdt-XXXXXX") pwd ''; wcd = pkgs.writers.writeDash "wcd" '' cd "$(readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" | xargs dirname)/.." ''; where = pkgs.writers.writeDash "where" '' readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" | xargs dirname ''; in { nixi = "nix repl nixpkgs"; take = "source ${take}"; wcd = "source ${wcd}"; where = "source ${where}"; # temporary files and directories cdt = "source ${cdt}"; vit = "$EDITOR $(mktemp)"; # file safety mv = "${pkgs.coreutils}/bin/mv --interactive"; rm = "${pkgs.coreutils}/bin/rm --interactive --verbose"; cp = "${pkgs.coreutils}/bin/cp --interactive"; # colours cat = "${pkgs.bat}/bin/bat --theme=ansi --style=plain"; l = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso --almost-all"; ls = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso"; ll = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso -l"; la = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso --almost-all -l"; o = "${pkgs.xdg-utils}/bin/xdg-open"; ns = "nix-shell --run zsh"; } // ( if isDarwin then { } else { "ß" = "${pkgs.util-linux}/bin/setsid"; ip = "${pkgs.iproute2}/bin/ip -c"; # systemd s = "${pkgs.systemd}/bin/systemctl"; us = "${pkgs.systemd}/bin/systemctl --user"; j = "${pkgs.systemd}/bin/journalctl"; uj = "${pkgs.systemd}/bin/journalctl --user"; } ); programs.tmux = { enable = true; keyMode = "vi"; clock24 = true; terminal = "screen-256color"; baseIndex = 1; aggressiveResize = true; escapeTime = 50; historyLimit = 7000; shortcut = "b"; extraConfig = '' set -g mouse on unbind * bind * list-clients # naVIgate bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # Use C-h and C-l to cycle through panes bind -r C-h select-window -t :- bind -r C-l select-window -t :+ setw -g monitor-activity on set -g visual-activity on set -g status-interval 2 set -g status-left-length 32 set -g status-right-length 150 set -g status-position bottom ''; }; }