8000 Add lnxlink to nixpkgs and docs for NixOS · Issue #257 · bkbilly/lnxlink · GitHub
[go: up one dir, main page]

Skip to content

Add lnxlink to nixpkgs and docs for NixOS #257

Open

Description

@giggio

When we are done fixing this NixOS related issues I'd like to contribute docs for the NixOS installation and maybe add lnxlink do the nixpkgs repo.

You can see in these 2 files the work necessary to get it to run:

First setting up the package, getting the executable to run:
https://codeberg.org/giggio/home-manager-config/src/commit/9f437b27901d2ee01e17b428e4f87aee1d8680ea/pkgs/python/lnxlink.nix

Then setting up the systemd service:
https://codeberg.org/giggio/home-manager-config/src/commit/9f437b27901d2ee01e17b428e4f87aee1d8680ea/services/lnxlink.nix

The service is looking good, when we finish fixing the issues I already opened it will be running fine. I believe you could also update your systemd service to better use the data, log and configuration directories as I'm doing in mine, plus the extra security features.

The package is taking a little more work than I'd like. I'm having to patch some of your dbus projects because the wheel and setuptools versions in nixpkgs are super new and conflict with your existing definitions.

I'm not a Python programmer and I don't know if there would be a problem removing that definition of maybe asking for a minimum version, instead of setting one up (like setuptools>=69.2.0 instead of setuptools~=69.2.0). I'm not even sure if that is allowed in the Python build tools.

When adding the packages to nixpkgs I can add you as a maintainer of the package in nixpkgs too, if you'd like. I'd probably need to add all those that are not there yet. Currently I am adding definitions for nvsmi, pyadmgpuinfo, dbus-networkdevices, dbus-mediaplayer and dbus-idle.

Also, for lnxlink I'm having to remove asyncio from pyproject.toml and requirements.txt. It seems it is not necessary to have them there, as they are part of the stdlib or something? Is that possible to be removed?

If those are added to nixpkgs, then running the service will be as easy as defining the configuration, something like:

services.lnxlink = {
  enable = true;
  config = { ... }; # the lnxlink configuration
  secretsFile = "path to your secrets environment file"; # optional
}

Maybe I could also add some properties to better define the setting that the user is required to set, we can discuss that later.

I can also then send a PR to your docs later.

Let me know what you think.
Cheers.

Activity

  1. added a commit that references this issue on Jul 9, 2026
  2. bkbilly commented on Jul 9, 2026

    @bkbilly
    Owner

    Asyncio didn't used to exist as a system library, but it seems that the python versions currently supported by LNXlink don't need this dependency.
    For the setuptools, you should not have any issues installing the latest versions, though I haven't tried it myself.

    I haven't used NixOS before, but I'd be more than happy to help you any way I can to add support for this.

  3. giggio commented on Jul 10, 2026

    @giggio
    ContributorAuthor

    Ok, I updated to the current HEAD and could remove the references to asyncio. But not the patches for setuptools and wheel:

      postPatch = ''
        substituteInPlace pyproject.toml \
          --replace-fail "setuptools~=68.0.0" "setuptools" \
          --replace-fail "wheel~=0.40.0" "wheel"
      '';

    I get this error when this is not there (end of logs):

           > ERROR Missing dependencies:
           >     setuptools~=68.0.0
           >      wheel~=0.40.0
    
  4. bkbilly commented on Jul 10, 2026

    @bkbilly
    Owner

    I am not sure if this helps, but I looked the nixpkgs repository and I found a random python package called jtbl which uses the setuptools and wheel dependencies, but in a different way. You can see this here:
    https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/jt/jtbl/package.nix

  5. giggio commented on Jul 10, 2026

    @giggio
    ContributorAuthor

    It seems that to use python3Packages.buildPythonApplication we'd need a setup.py file. Docs:

    https://wiki.nixos.org/wiki/Python#Package_a_Python_application

    Isn't there a way to say that the app depends on versions x and above, something like setuptools>=68.0.0?

  6. bkbilly commented on Jul 11, 2026

    @bkbilly
    Owner

    I've pushed an update which removes the wheel dependency and uses setuptools>=61.0.
    Hopefully this will make things easier to package LNXlink.

    EDIT: I've also done this change on the other dependencies which I've pushed them to version 2026.7.0: dbus-idle, dbus-mediaplayer, dbus-networkdevices

  7. giggio commented on Jul 12, 2026

    @giggio
    ContributorAuthor

    Ok, I've updated my build configuration, it is much simpler now. I could remove wheel from the build and I don't need to patch pyproject.toml anymore. That goes for all your projects! Thanks!
    Here is the current build configuration:
    https://codeberg.org/giggio/home-manager-config/src/commit/d649dc957d540c5d010f99e816c36c51125d36c6/pkgs/python/lnxlink.nix

    Build with:

    nix build --impure --expr '(import ./python.nix { pkgs = import <nixpkgs> {}; }).withPackages (python-pkgs: [ python-pkgs.lnxlink ])'

    (from the python directory and inspect the 8000 result directory)

    Now, when the next version of lnxlink is published I'll be able to update the configuration to take directly from Pypi, just as I'm doing with the others. After that, I can send a PR to nixpkgs for the package, work through it, then after that is integrated I can send a PR to home-manager for service integration. And after that we can add docs to lnxlink on how to use it with Nix. It'll take a few weeks but it is going to be super easy.

  8. bkbilly commented on Jul 13, 2026

    @bkbilly
    Owner

    The new build configuration seems much simpler now.
    I noticed that the library dbus_notification is missing which I've also updated to the 2026.7.0 version.
    I've released the version 2026.7.0 of LNXlink, so you can proceed with the rest of the process to publish this to NixOS.
    Thank you for all your help with this!

  9. giggio commented on Jul 15, 2026

    @giggio
    ContributorAuthor

    Ok, I updated the service to the latest version and I added dbus_notification and it is working fine.
    I'll start the process to include it in nixpkgs. Would you like to be added as a maintainer there?

  10. bkbilly commented on Jul 15, 2026

    @bkbilly
    Owner

    I would love to be added as a maintainer.

  11. giggio commented on Jul 28, 2026

    @giggio
    ContributorAuthor

    Now that we've closed the last issue to get it all working, I'll start working on my local machine in a configuration that I can upstream to nixpkgs. I'm kinda busy with other things right now, but I'll get it done.
    Thanks for all the support in all the issues I've opened, @bkbilly !

  12. github-actions commented on Aug 22, 2026

    @github-actions
    Contributor

    No activity on this issue recently. Make sure you update to the latest version of LNXlink to check if the issue has been resolved.
    If no further activity occurs, the issue will be closed.

  13. giggio commented on Aug 23, 2026

    @giggio
    ContributorAuthor

    I'll work on it.

  14. giggio commented on Sep 12, 2026

    @giggio
    ContributorAuthor

    @bkbilly I have an initial implementation, coming from this commit: https://codeberg.org/giggio/home-manager-config/commit/5811714b60ba81afeef229acb9f45683bea674ce

    This is my usage of the module, so this is what would be needed for a user of lnxlink to set it up with Nix: https://codeberg.org/giggio/home-manager-config/src/commit/5811714b60ba81afeef229acb9f45683bea674ce/services/lnxlink/lnxlink.nix

    This is the most important file to analyze. Do you approve the way I chose to set up usage?

    Now, the implementation:

    These are the packages I need to provide to Nix, besides lnxlink there are others: https://codeberg.org/giggio/home-manager-config/src/commit/5811714b60ba81afeef229acb9f45683bea674ce/pkgs/python/lnxlink

    You are not a maintainer yet on these files because that will only show up when I send the first PR, when I'll update the maintainers nix references.

    This is the service module itself: https://codeberg.org/giggio/home-manager-config/src/commit/5811714b60ba81afeef229acb9f45683bea674ce/services/lnxlink/module.nix

    Let me know what you think, I can work with what you may need to improve.

  15. bkbilly commented on Sep 13, 2026

    @bkbilly
    Owner

    I've noticed that you have specific modules enabled by default.
    I think it would be useful to add a comment on the modules section to mention that if this is null, then it will load everything.

    Overall I can't find any issue with this implementation.
    It looks straightforward on how people can use it.

  16. giggio commented on Sep 14, 2026

    @giggio
    ContributorAuthor

    My configuration is loading several modules, but that won't go to nixpkgs, what will go is the module.nix file, which sets modules to null.
    If that is all, I can start to work on submitting it to nixpkgs. Ok?

  17. bkbilly commented on Sep 18, 2026

    @bkbilly
    Owner

    That's perfectly fine.

  18. giggio commented on Oct 6, 2026

    @giggio
    ContributorAuthor

    Opened PR in nixpkgs: NixOS/nixpkgs#570735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0