This commit is contained in:
Denis Lehmann 2025-02-01 15:44:29 +01:00
parent a77ab633ca
commit 4b372f12c8
5 changed files with 36 additions and 73 deletions

26
flake.lock generated
View file

@ -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"
}
}

View file

@ -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;
}
);
};
}

View file

@ -1,2 +0,0 @@
colour
toml

28
bin/rzr → rzr Normal file → Executable file
View file

@ -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.",

View file

@ -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(),