From 83925702fc26785f27e5b2b6bf49cdfbabb86838 Mon Sep 17 00:00:00 2001 From: spacelike Date: Tue, 30 Apr 2019 07:38:14 -0600 Subject: [PATCH 1/2] Use guix directly to report package count instead of counting directories --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 6e7c60c5..b9719687 100755 --- a/neofetch +++ b/neofetch @@ -1331,7 +1331,6 @@ get_packages() { { has "emerge" && dir ${br_prefix}/var/db/pkg/*/*/ has "nix-env" && dir ${br_prefix}/nix/store/*/ - has "guix" && dir ${br_prefix}/gnu/store/*/ has "Compile" && dir ${br_prefix}/Programs/*/ has "eopkg" && dir ${br_prefix}/var/lib/eopkg/package/* has "crew" && dir ${br_prefix}/usr/local/etc/crew/meta/*.filelist @@ -1342,6 +1341,7 @@ get_packages() { # Other (Needs complex command) has "kpm-pkg" && ((packages+="$(kpm --get-selections | grep -cv deinstall$)")) + has "guix" && ( manager="guix-system" && tot guix package -p /run/current-system/profile -I ; manager="guix-user" && tot guix package -I ) # pkginfo is also the name of a python package manager which is painfully slow. # TODO: Fix this somehow. From 619ebdacd6a1f4c9dfb9e5643716374cb65afbee Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Wed, 1 May 2019 07:26:04 +0700 Subject: [PATCH 2/2] Packages [Guix/Nix]: Use if for detecting system and user packages --- neofetch | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index b9719687..92a38a69 100755 --- a/neofetch +++ b/neofetch @@ -1330,7 +1330,6 @@ get_packages() { # shellcheck disable=SC2086 { has "emerge" && dir ${br_prefix}/var/db/pkg/*/*/ - has "nix-env" && dir ${br_prefix}/nix/store/*/ has "Compile" && dir ${br_prefix}/Programs/*/ has "eopkg" && dir ${br_prefix}/var/lib/eopkg/package/* has "crew" && dir ${br_prefix}/usr/local/etc/crew/meta/*.filelist @@ -1341,7 +1340,16 @@ get_packages() { # Other (Needs complex command) has "kpm-pkg" && ((packages+="$(kpm --get-selections | grep -cv deinstall$)")) - has "guix" && ( manager="guix-system" && tot guix package -p /run/current-system/profile -I ; manager="guix-user" && tot guix package -I ) + + if has "guix"; then + manager="guix-system" && tot guix package -p "/run/current-system/profile" -I + manager="guix-user" && tot guix package -I + fi + + if has "nix-store"; then + manager="nix-system" && tot nix-store -q --requisites "/run/current-system/sw" + manager="nix-user" && tot nix-store -q --requisites "$HOME/.nix-profile" + fi # pkginfo is also the name of a python package manager which is painfully slow. # TODO: Fix this somehow. @@ -1371,7 +1379,11 @@ get_packages() { has "port" && tot port installed && ((packages-=1)) has "brew" && dir /usr/local/Cellar/* has "pkgin" && tot pkgin list - has "nix-env" && dir /nix/store/*/ + + if has "nix-store"; then + manager="nix-system" && tot nix-store -q --requisites "/run/current-system/sw" + manager="nix-user" && tot nix-store -q --requisites "$HOME/.nix-profile" + fi ;; "AIX"| "FreeMiNT") @@ -1415,7 +1427,6 @@ get_packages() { fi packages="${packages/pacman-key/pacman}" - packages="${packages/nix-env/nix}" } get_shell() {