From 97138dce31b5dc9ffacaf7929d955f3498d20da9 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Sun, 22 May 2022 22:29:16 +0100 Subject: [PATCH 1/2] Refactor packages.py and add nixos (both profiles & nix-env) --- packages.py | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/packages.py b/packages.py index 6b1c410..b5d4897 100644 --- a/packages.py +++ b/packages.py @@ -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): - try: - return len(check_output(["pacman", "-Qq"]).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 + for command in commands: + try: + return len(check_output(command.split(" ")).decode("utf-8").split("\n")) - 1 + except FileNotFoundError: + pass + return False From 3bdf94e9284f681dd8771d3620efc5378513ecd2 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Mon, 23 May 2022 09:22:18 +0100 Subject: [PATCH 2/2] Update flake info to add package meta --- flake.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/flake.nix b/flake.nix index fc480e8..b5173b5 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }; }; });