128 lines
2.3 KiB
Nix
128 lines
2.3 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
|
|
memoryUsage = pkgs.writers.writeDashBin "memory-total-usage" ''
|
|
echo " %CPU %MEM MEM : PROCESS"
|
|
echo "------- ------- ------------- -------"
|
|
ps aux | awk '{mem[$11]+=int($6/1024)}; {cpuper[$11]+=$3};{memper[$11]+=$4}; END {for (i in mem) {printf "%6.2f%% %6.2f%% %10.2f MB : %s\n", cpuper[i],memper[i],mem[i],i}}' | sort -k3nr | head -n 5
|
|
'';
|
|
|
|
prefetch-git-rendered = pkgs.writeShellScriptBin "nix-prefetch-git-rendered" ''
|
|
${pkgs.nix-prefetch-scripts}/bin/nix-prefetch-git "$@" \
|
|
| ${pkgs.jq}/bin/jq --raw-output '"pkgs.fetchgit{
|
|
url = \"\(.url)\";
|
|
rev = \"\(.rev)\";
|
|
sha256 = \"\(.sha256)\";
|
|
};"'
|
|
'';
|
|
|
|
prefetch-url-rendered = pkgs.writeShellScriptBin "nix-prefetch-url-rendered" ''
|
|
HASH=$( ${pkgs.nix}/bin/nix-prefetch-url "$1" )
|
|
cat <<EOF
|
|
pkgs.fetchurl {
|
|
url = "$1";
|
|
sha256 = "$HASH";
|
|
};
|
|
EOF
|
|
'';
|
|
|
|
storepath =
|
|
let
|
|
dirname = "${pkgs.coreutils-full}/bin/dirname";
|
|
readlink = "${pkgs.coreutils-full}/bin/readlink";
|
|
in
|
|
pkgs.writers.writeBashBin "storepath" ''
|
|
${dirname} $( ${readlink} $( type -p "$1" ) )
|
|
'';
|
|
|
|
in
|
|
{
|
|
|
|
programs.tmux = {
|
|
enable = true;
|
|
clock24 = true;
|
|
historyLimit = 150000;
|
|
secureSocket = true;
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
# to browse logs better
|
|
lnav
|
|
|
|
nix-tree
|
|
nixos-option
|
|
|
|
storepath
|
|
|
|
prefetch-git-rendered
|
|
prefetch-url-rendered
|
|
|
|
parallel
|
|
|
|
# windos/mac filesystems
|
|
ntfs3g
|
|
exfat
|
|
|
|
silver-searcher
|
|
bc
|
|
bridge-utils
|
|
file
|
|
git
|
|
htop
|
|
lsof
|
|
ncdu
|
|
tree
|
|
vim
|
|
wget
|
|
zip
|
|
unzip
|
|
|
|
jq
|
|
ijq
|
|
miller
|
|
|
|
tmux
|
|
screen
|
|
|
|
tcpdump
|
|
|
|
duc
|
|
|
|
memoryUsage
|
|
|
|
treefmt
|
|
shellcheck
|
|
shfmt
|
|
black
|
|
nodePackages.prettier
|
|
influxdb2-cli
|
|
|
|
#gitlog2json
|
|
|
|
pciutils
|
|
|
|
(pkgs.writers.writeDashBin "mc" ''
|
|
${pkgs.mc}/bin/mc --nocolor "$@"
|
|
'')
|
|
|
|
(pkgs.writers.writeBashBin "ssl-check-cert-of-domain" ''
|
|
DOMAIN=$1
|
|
echo | \
|
|
${pkgs.openssl}/bin/openssl s_client -servername ''${DOMAIN} -connect ''${DOMAIN}:443 2>/dev/null | \
|
|
${pkgs.openssl}/bin/openssl x509 -text | \
|
|
${pkgs.less}/bin/less
|
|
'')
|
|
|
|
];
|
|
|
|
# configure navi
|
|
#environment.variables.NAVI_PATH = "$HOME/.cheats";
|
|
|
|
}
|