Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rivalcfg: init at 3.6.0 #66534

Closed
wants to merge 2 commits into from
Closed

rivalcfg: init at 3.6.0 #66534

wants to merge 2 commits into from

Conversation

ornxka
Copy link
Contributor

@ornxka ornxka commented Aug 12, 2019

Motivation for this change

added the rivalcfg package for configuring steelseries mice

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

license = licenses.wtfpl;
};

src = fetchurl {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using fetchFromGitHub is preferred

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, although it will resolve mostly to the same thing.


meta = with stdenv.lib; {
description = "Small CLI utility program that allows you to configure SteelSeries Rival gaming mice";
license = licenses.wtfpl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should include a homepage (even if this is the same as the github url) and a maintainer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the maintainer me? Should I add myself to the maintainers file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are happy to be the maintainer you should make a seperate commit adding yourself to the maintainers file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainer is someone with some working knowledge of a package, and some amount of care

pname = "rivalcfg";
version = "3.6.0";

meta = with stdenv.lib; {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta usually goes at the bottom, though this is just a style thing

@@ -0,0 +1,19 @@
{ stdenv, fetchurl, python3Packages }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could have lib instead of stdenv here

@@ -0,0 +1,19 @@
{ stdenv, fetchurl, python3Packages }:

with python3Packages; buildPythonPackage rec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen with python3Packages; used before, do you have an example where this has been used somewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in tools/text/invoice2data. I grepped for buildPythonPackage since I was getting an error and copied from that package. Should I be using python37Packages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, I am not a python expert. My query was more about using with instead of python3Packages.buildPythonPackage here and moving the with python3Packages to the buildInputs. It can be confusing to have big with clauses, for example it is not obvious that the build inputs are coming form python3Packages

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3Package, python37Packages, python3.pkgs are all aliases of each other.


users.extraGroups.mouse.gid = config.ids.gids.mouse;
services.udev.extraRules = ''
# SteelSeries Rival
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you sourcing these rules from? It may be better to set up a derivation to fetch these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those rules are from a file in the project itself, modified so that it uses the mouse group instead of just chmodding the device nodes to 0666 because that seemed like a bad idea to me. I wasn't sure how to patch it and add it to the store though (it doesn't get installed by default), so I just hardcoded it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use substituteAll or a regular patch to patch it and you could maybe add to postInstall to manually install it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try that.

sha256 = "78bd2ed860ad62b5bcd2fba334d8b9fda04524f7d45dd4f57dc20d9b4124110b";
};

doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do the tests not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't, it won't install with them enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it look fixable? it would be better to have the tests if they can be made to work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not by me, I looked into it a bit when it was failing and had no idea what it was doing.

@@ -3947,6 +3947,10 @@
github = "orivej";
name = "Orivej Desh";
};
ornxka = {
email = "ornx@protonmail.com"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your python package should look something like this:

with python3Packages; buildPythonPackage rec {
  pname = "rivalcfg";
  version = "3.6.0";

  src = fetchFromGitHub {
    owner = "flozz";
    repo = "rivalcfg";
    rev = "v${version}";
    sha256 = "1xfaxc2qhbgi46m8ihhcgk9xfgkrvaqk0fhfav13378cihhdwwpn";
  };

  propagatedBuildInputs = [ hidapi ];

  checkInputs = [ pytest ];

  checkPhase = "pytest";

  meta = with stdenv.lib; {
    description = "Small CLI utility program that allows you to configure SteelSeries Rival gaming mice";
    license     = licenses.wtfpl;
  };
}

@ornxka
Copy link
Contributor Author

ornxka commented Aug 13, 2019

Thank you all for your input on this pull request, it has been very helpful. I believe the latest version incorporates all of your feedback and I have tested it on my machine and it seems to work, including the tests. Please tell me if there are any further issues.

@jonringer
Copy link
Contributor

jonringer commented Aug 13, 2019

I would also consolidate your commits as so:

maintainers: add ornxka # only the maintainer entry
rivalcfg: init at 3.6.0        # python package, and entry in all-packages.nix
nixos/programs/rivalcfg: init #nixos related changes

I'm not super familiar with doing nixos modules, but seems more "correct"

cc @infinisil for his nixos knowledge and a review :)

@ornxka
Copy link
Contributor Author

ornxka commented Aug 13, 2019

I have consolidated the commits and fixed the commit messages.

@@ -640,6 +640,7 @@
cockroachdb = 313;
zoneminder = 314;
paperless = 315;
mouse = 316;
Copy link
Member

@infinisil infinisil Aug 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't assign a static id, see #65698

Here you can just not assign one and NixOS will choose a group automatically

};

users.extraGroups.mouse.gid = config.ids.gids.mouse;
services.udev.extraRules = fileContents "${pkgs.rivalcfg}/share/rivalcfg/99-steelseries-rival.rules";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no good, this requires IFD to evaluate, you should use udev.packages or so instead

@ornxka
Copy link
Contributor Author

ornxka commented Aug 20, 2019

I dropped the module (I figure I can just use the "users" group instead of making a new group), and updated the package so it can be used with udev.packages.

@alexarice
Copy link
Contributor

I don't think dropping the module is necessary, but instead include a simple module which adds the package to udev.packages and environment.systemPackages

A bit like https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/light.nix

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@ornxka ornxka mentioned this pull request Oct 25, 2021
12 tasks
@Artturin Artturin closed this Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants