mirror of
https://github.com/SpyHoodle/PrideFetch.git
synced 2024-11-09 21:25:42 +00:00
Merge pull request #4 from SpyHoodle/nixpkgs
This commit is contained in:
commit
60f176340b
21
flake.nix
21
flake.nix
@ -25,6 +25,27 @@
|
|||||||
cp ${./packages.py} $out/bin/packages.py
|
cp ${./packages.py} $out/bin/packages.py
|
||||||
chmod +x $out/bin/pridefetch
|
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;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
40
packages.py
40
packages.py
@ -1,28 +1,20 @@
|
|||||||
from subprocess import check_output
|
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):
|
def get_num_packages() -> (int, bool):
|
||||||
try:
|
for command in commands:
|
||||||
return len(check_output(["pacman", "-Qq"]).decode("utf-8").split("\n")) - 1
|
try:
|
||||||
except FileNotFoundError:
|
return len(check_output(command.split(" ")).decode("utf-8").split("\n")) - 1
|
||||||
pass
|
except FileNotFoundError:
|
||||||
try:
|
pass
|
||||||
return len(check_output(["apt", "list", "--installed"]).decode("utf-8").split("\n")) - 1
|
return False
|
||||||
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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user