optimise pacakge count command for nixos

This commit is contained in:
Phani Rithvij 2024-11-23 19:18:28 +00:00 committed by jschx
parent 12b68fa355
commit 9c7e593b10

View file

@ -9,9 +9,14 @@ host="$(hostname)"
os="$(nixos-version)"
kernel="$(uname -sr)"
uptime="$(uptime | awk -F, '{sub(".*up ",x,$1);print $1}' | sed -e 's/^[ \t]*//')"
packages="$(ls -d -1 /nix/store/*/ | wc -l)"
shell="$(basename "${SHELL}")"
for profile in $NIX_PROFILES; do
if [ -d "$profile" ]; then
packages="$((packages + $( (nix-store -q --requisites "$profile" 2>/dev/null || printf '') | wc -l)))"
fi
done
## UI DETECTION
parse_rcs() {