2019-10-24 02:20:38 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
pastebin = pkgs.writers.writeDashBin "pastebin" # sh
|
|
|
|
''
|
|
|
|
exec ${pkgs.bepasty-client-cli}/bin/bepasty-cli \
|
|
|
|
--lifetime 1m \
|
|
|
|
--url http://workhorse.private:8000 \
|
|
|
|
--pass ${lib.fileContents <common_secrets/bepasty/admin-password>} \
|
|
|
|
"$@" | sed -e s/workhorse.private:8000/paste.ingolf-wagner.de/
|
|
|
|
'';
|
|
|
|
|
|
|
|
memoryUsage = pkgs.writers.writeDashBin "memory-total-usage" # sh
|
|
|
|
''
|
|
|
|
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" # sh
|
|
|
|
''
|
|
|
|
${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" # sh
|
|
|
|
''
|
|
|
|
HASH=$( ${pkgs.nix}/bin/nix-prefetch-url "$1" )
|
|
|
|
cat <<EOF
|
|
|
|
pkgs.fetchurl {
|
|
|
|
url = "$1";
|
|
|
|
sha256 = "$HASH";
|
|
|
|
};
|
|
|
|
EOF
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2020-03-10 04:27:20 +01:00
|
|
|
|
2019-10-24 02:20:38 +02:00
|
|
|
in {
|
|
|
|
|
|
|
|
programs.tmux = {
|
|
|
|
enable = true;
|
|
|
|
clock24 = true;
|
|
|
|
historyLimit = 150000;
|
|
|
|
secureSocket = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
|
|
|
prefetch-git-rendered
|
|
|
|
prefetch-url-rendered
|
|
|
|
|
|
|
|
parallel
|
|
|
|
|
|
|
|
# windos/mac filesystems
|
|
|
|
ntfs3g
|
|
|
|
exfat
|
|
|
|
|
|
|
|
ag
|
|
|
|
bc
|
|
|
|
bridge-utils
|
|
|
|
file
|
|
|
|
git
|
|
|
|
htop
|
|
|
|
lsof
|
|
|
|
ncdu
|
|
|
|
tree
|
|
|
|
vim
|
|
|
|
wget
|
2019-12-20 05:54:26 +01:00
|
|
|
zip
|
|
|
|
unzip
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
pastebin
|
|
|
|
|
|
|
|
jq
|
|
|
|
miller
|
|
|
|
|
|
|
|
tmux
|
|
|
|
screen
|
|
|
|
|
|
|
|
duc
|
|
|
|
|
|
|
|
memoryUsage
|
|
|
|
|
2019-10-26 15:52:35 +02:00
|
|
|
#gitlog2json
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
pciutils
|
|
|
|
|
2020-03-10 04:27:20 +01:00
|
|
|
(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
|
|
|
|
'')
|
|
|
|
|
2019-10-24 02:20:38 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|