Merge pull request #4 from SpyHoodle/nixpkgs

This commit is contained in:
Madeleine 2022-05-23 11:14:44 +01:00 committed by GitHub
commit 60f176340b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 24 deletions

View File

@ -25,6 +25,27 @@
cp ${./packages.py} $out/bin/packages.py
chmod +x $out/bin/pridefetch
'';
meta = with pkgs.lib; {
description = "Print out system statistics with pride flags";
longDescription = ''
Pridefetch prints your system statistics (similarly to neofetch, screenfetch or pfetch) along with a pride flag.
The flag which is printed is configurable, as well as the width of the output.
'';
homepage = https://github.com/SpyHoodle/pridefetch;
license = "bsd";
# https://static.domenkozar.com/nixpkgs-manual-sphinx-exp/meta.xml.html
# > Catch-all for licenses that are essentially similar to the original BSD license with the advertising clause removed, i.e. permissive non-copyleft free software licenses. This includes the X11 (“MIT”) License.
# our license is MIT, so BSD is set here
maintainers = [
{
email = "skyler3665@gmail.com";
github = "minion3665";
githubId = 34243578;
name = "Skyler Grey";
}
]; # TODO: Replace this with a reference to the maintainer list after adding myself to it
platforms = systems.supported.hydra;
};
};
});

View File

@ -1,28 +1,20 @@
from subprocess import check_output
commands = [
"pacman -Qq",
"apt list --installed",
"yum list installed",
"dnf list installed",
"qlist -I",
"nix profile list",
"nix-env -q",
"rpm -qa",
]
def get_num_packages() -> (int, bool):
for command in commands:
try:
return len(check_output(["pacman", "-Qq"]).decode("utf-8").split("\n")) - 1
return len(check_output(command.split(" ")).decode("utf-8").split("\n")) - 1
except FileNotFoundError:
pass
try:
return len(check_output(["apt", "list", "--installed"]).decode("utf-8").split("\n")) - 1
except FileNotFoundError:
pass
try:
return len(check_output(["yum", "list", "installed"]).decode("utf-8").split("\n")) - 1
except FileNotFoundError:
pass
try:
return len(check_output(["dnf", "list", "installed"]).decode("utf-8").split("\n")) - 1
except FileNotFoundError:
pass
try:
return len(check_output(["qlist", "-I"]).decode("utf-8").split("\n")) - 1
except FileNotFoundError:
pass
try:
return len(check_output(["rpm", "-qa"]).decode("utf-8").split("\n")) - 1
except FileNotFoundError:
return False