Commit 7e7d4839 authored by phanirithvij's avatar phanirithvij
Browse files

ufetch: 0.3 -> 0.4

parent 3917762e
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
diff --git a/ufetch-nixos b/ufetch-nixos
index 2ca8f9d..5102cd7 100755
--- a/ufetch-nixos
+++ b/ufetch-nixos
@@ -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 || true) | wc -l)))"
+	fi
+done
+
 ## UI DETECTION

 parse_rcs() {
+2 −4
Original line number Diff line number Diff line
@@ -9,17 +9,15 @@

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "ufetch";
  version = "0.3";
  version = "0.4";

  src = fetchFromGitLab {
    owner = "jschx";
    repo = "ufetch";
    rev = "v${finalAttrs.version}";
    hash = "sha256-1LtVCJrkdI2AUdF5d/OBCoSqjlbZI810cxtcuOs/YWs=";
    hash = "sha256-icrf7OjDageBRSBD40wX2ZzCvB6T5n0jgd5aRROGqCA=";
  };

  patches = [ ./0001-optimize-packages-command.patch ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin $out/share/licenses/${finalAttrs.pname}