1212#include <sys/stat.h>
1313
1414#define FF_PACKAGES_MODULE_NAME "Packages"
15- #define FF_PACKAGES_NUM_FORMAT_ARGS 11
15+ #define FF_PACKAGES_NUM_FORMAT_ARGS 12
1616
1717typedef struct PackageCounts
1818{
@@ -21,6 +21,7 @@ typedef struct PackageCounts
2121 uint32_t rpm ;
2222 uint32_t emerge ;
2323 uint32_t xbps ;
24+ uint32_t nixSystem ;
2425 uint32_t nixDefault ;
2526 uint32_t flatpak ;
2627 uint32_t snap ;
@@ -228,8 +229,13 @@ static void getPackageCounts(const FFinstance* instance, FFstrbuf* baseDir, Pack
228229 packageCounts -> flatpak += getNumElements (baseDir -> chars , DT_DIR );
229230 ffStrbufSubstrBefore (baseDir , baseDirLength );
230231
231- //nix default
232+ //nix system
232233 ffStrbufAppendS (baseDir , "/run/current-system" );
234+ packageCounts -> nixSystem += getNixPackages (baseDir -> chars );
235+ ffStrbufSubstrBefore (baseDir , baseDirLength );
236+
237+ //nix default
238+ ffStrbufAppendS (baseDir , "/nix/var/nix/profiles/default" );
233239 packageCounts -> nixDefault += getNixPackages (baseDir -> chars );
234240 ffStrbufSubstrBefore (baseDir , baseDirLength );
235241
@@ -307,7 +313,7 @@ void ffPrintPackages(FFinstance* instance)
307313
308314 ffStrbufDestroy (& baseDir );
309315
310- uint32_t all = counts .dpkg + counts .emerge + counts .flatpak + counts .nixDefault + nixUser + counts .pacman + counts .rpm + counts .snap + counts .xbps ;
316+ uint32_t all = counts .dpkg + counts .emerge + counts .flatpak + counts .nixSystem + counts . nixDefault + nixUser + counts .pacman + counts .rpm + counts .snap + counts .xbps ;
311317 if (all == 0 )
312318 {
313319 ffPrintError (instance , FF_PACKAGES_MODULE_NAME , 0 , & instance -> config .packages , "No packages from known package managers found" );
@@ -346,6 +352,13 @@ void ffPrintPackages(FFinstance* instance)
346352 printf (", " );
347353 }
348354
355+ if (counts .nixSystem > 0 )
356+ {
357+ printf ("%u (nix-system)" , counts .nixSystem );
358+ if ((all = all - counts .nixSystem ) > 0 )
359+ printf (", " );
360+ }
361+
349362 if (counts .nixDefault > 0 )
350363 {
351364 printf ("%u (nix-default)" , counts .nixDefault );
@@ -374,6 +387,7 @@ void ffPrintPackages(FFinstance* instance)
374387 {FF_FORMAT_ARG_TYPE_UINT , & counts .emerge },
375388 {FF_FORMAT_ARG_TYPE_UINT , & counts .xbps },
376389 {FF_FORMAT_ARG_TYPE_UINT , & nixUser },
390+ {FF_FORMAT_ARG_TYPE_UINT , & counts .nixSystem },
377391 {FF_FORMAT_ARG_TYPE_UINT , & counts .nixDefault },
378392 {FF_FORMAT_ARG_TYPE_UINT , & counts .flatpak },
379393 {FF_FORMAT_ARG_TYPE_UINT , & counts .snap }
0 commit comments