From a8dbaf61573f92265155ba71cb046ad80c51c922 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Sat, 1 Feb 2025 15:49:12 +0100 Subject: [PATCH] cleanup --- README.org | 4 ++-- flake.lock | 26 ++++---------------------- flake.nix | 46 +++++++++++++++++++++++++++------------------- requirements.txt | 2 -- bin/rzr => rzr | 28 +++------------------------- setup.py | 7 ++----- 6 files changed, 38 insertions(+), 75 deletions(-) delete mode 100644 requirements.txt rename bin/rzr => rzr (91%) mode change 100644 => 100755 diff --git a/README.org b/README.org index 3543529..97e6970 100644 --- a/README.org +++ b/README.org @@ -118,7 +118,7 @@ t = [2, 6] #+end_src - The =tab= identifies for example the key in the third row and second colum (counting starts at 0) which is the tabulator key on the keyboard. + The =tab= identifies for example the key in the third row and second column (counting starts at 0) which is the tabulator key on the keyboard. Those identifiers can then be used in profiles to set light colors. *** Profiles @@ -183,7 +183,7 @@ The =;= waits until the game exited and the =rzr= command finally applies your =default= profile. - It is neccessary that *rzr* is installed correctly and available in your =$PATH=, otherwise Steam will not be able to call it. + It is necessary that *rzr* is installed correctly and available in your =$PATH=, otherwise Steam will not be able to call it. ** Troubleshooting diff --git a/flake.lock b/flake.lock index c46589a..81f8d16 100644 --- a/flake.lock +++ b/flake.lock @@ -1,28 +1,11 @@ { "nodes": { - "flake-utils": { - "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1642069818, - "narHash": "sha256-666w6j8wl/bojfgpp0k58/UJ5rbrdYFbI2RFT2BXbSQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "46821ea01c8f54d2a20f5a503809abfc605269d7", - "type": "github" + "lastModified": 0, + "narHash": "sha256-GFzPxJzTd1rPIVD4IW+GwJlyGwBDV1Tj5FLYwDQQ9sM=", + "path": "/nix/store/50yickar04m51aqnc43gxf45g2i0n3k9-source", + "type": "path" }, "original": { "id": "nixpkgs", @@ -31,7 +14,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index d2c4c05..2f54069 100644 --- a/flake.nix +++ b/flake.nix @@ -1,42 +1,50 @@ { description = "A simple command line frontend for OpenRazer"; - nixConfig.bash-prompt = "\[\\e[1m\\e[32mrzr-develop\\e[0m\]$ "; - inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem - (system: + outputs = { self, nixpkgs }@inputs: + let + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix; + + nixpkgsFor = forAllSystems (system: import nixpkgs { + inherit system; + }); + in + { + packages = forAllSystems (system: let - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = nixpkgsFor.${system}; in { - # Package - packages.rzr = - pkgs.python3Packages.buildPythonApplication rec { - name = "rzr"; + rzr = + pkgs.python3Packages.buildPythonPackage { + pname = "rzr"; + version = "main"; src = self; - nativeBuildInputs = with pkgs; [ - wrapGAppsHook - ]; propagatedBuildInputs = with pkgs; [ python3Packages.colour python3Packages.openrazer python3Packages.toml ]; }; - defaultPackage = self.packages.${system}.rzr; + default = self.packages.${system}.rzr; + } + ); - # Development shell - devShell = pkgs.mkShell { + devShells = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + rzr = pkgs.mkShell { buildInputs = with pkgs; [ python3 python3Packages.colour python3Packages.openrazer - python3Packages.pip - python3Packages.setuptools python3Packages.toml - python3Packages.virtualenv + ]; }; + default = self.devShells.${system}.rzr; } ); + }; } diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 24b2319..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -colour -toml diff --git a/bin/rzr b/rzr old mode 100644 new mode 100755 similarity index 91% rename from bin/rzr rename to rzr index c325064..7c243cf --- a/bin/rzr +++ b/rzr @@ -12,24 +12,6 @@ import toml import sys -def print_greeter(): - """Print greeter.""" - greeter = """ _ _ _ - /\ \ /\ \ /\ \ - / \ \ / \ \ / \ \ - / /\ \ \ __/ /\ \ \ / /\ \ \ - / / /\ \_\/___/ /\ \ \ / / /\ \_\ - / / /_/ / /\___\/ / / / / / /_/ / / - / / /__\/ / / / / / / /__\/ / - / / /_____/ / / / _ / / /_____/ - / / /\ \ \ \ \ \__/\_\ / / /\ \ \ -/ / / \ \ \ \ \___\/ // / / \ \ \ -\/_/ \_\/ \/___/_/ \/_/ \_\/ - """ - - print(greeter) - - def error(msg, e=True): """Print error to stderr and exit eventually.""" print("ERROR: {}".format(msg), file=sys.stderr) @@ -102,9 +84,9 @@ def apply_device_profile(device_profile): if "lights" in device_profile: for light in device_profile["lights"]: color_tuple = get_color_tuple((device_profile["lights"][light])) - device.fx.advanced.matrix[ - lightmap[light][0], lightmap[light][1] - ] = color_tuple + device.fx.advanced.matrix[lightmap[light][0], lightmap[light][1]] = ( + color_tuple + ) else: device.fx.none() @@ -214,12 +196,8 @@ def list_profiles(): def main(): - global device_manager, lightmap_directory, profile_directory - # Print greeter - print_greeter() - # Parse arguments parser = argparse.ArgumentParser( description="A simple command line frontend for OpenRazer.", diff --git a/setup.py b/setup.py index 5554b5f..ed90cdd 100644 --- a/setup.py +++ b/setup.py @@ -2,11 +2,8 @@ from setuptools import setup setup( name="rzr", - version="0.0.1", - author="Denis Lehmann", - author_email="denis@opaque.tech", - scripts=["bin/rzr"], - url="https://git.opaque.tech/denis/rzr", + scripts=["./rzr"], + py_modules=[], license="LICENSE", description="A simple command line frontend for OpenRazer", long_description=open("README.org").read(),