Skip to content

feat: nix flake to build this on nix.#2

Open
dzuberi wants to merge 11 commits into
sobalap:mainfrom
dzuberi:main
Open

feat: nix flake to build this on nix.#2
dzuberi wants to merge 11 commits into
sobalap:mainfrom
dzuberi:main

Conversation

@dzuberi

@dzuberi dzuberi commented Apr 18, 2026

Copy link
Copy Markdown

The flake creates and adds the package, automatically adds the udev rule, fixes the binary location for the systemd service, and enables the systemd service. It worked on my system.

@dzuberi

dzuberi commented Apr 18, 2026

Copy link
Copy Markdown
Author

Fixes #1

@dzuberi

dzuberi commented Apr 18, 2026

Copy link
Copy Markdown
Author

Possible limitation: assumes pipewire and wireplumber are enabled since the service depends on it. Whether to force enable them in the default nixosModule or to just note this in documentation is an open topic.

@sobalap

sobalap commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Hello, appreciate you taking interest in the project.

Possible limitation: assumes pipewire and wireplumber are enabled since the service depends on it. Whether to force enable them in the default nixosModule or to just note this in documentation is an open topic.

I think an assertion or a warning in the flake if pipewire/wireplumber is absent would be ideal.

Then we could merge.

@dzuberi

dzuberi commented Apr 19, 2026

Copy link
Copy Markdown
Author

Assertions added

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds Nix flake packaging and a NixOS module to build/install btd700ctl artifacts and integrate udev + systemd user service enablement, plus README documentation for Nix usage.

Changes:

  • Introduce flake.nix with a packages output and nixosModules.default for NixOS integration.
  • Package udev rules and patch/wrap the btd700d systemd user service for Nix store paths.
  • Document Nix flake/module usage in README.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
flake.nix Defines a Nix package derivation, installs udev rules, patches/wraps btd700d, and adds a NixOS module intended to enable the user service.
README.md Adds a Nix configuration snippet showing how to consume the flake’s NixOS module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread flake.nix Outdated
Comment thread flake.nix Outdated
Comment thread flake.nix Outdated
buildInputs = with pkgs; [ hidapi ];

postInstall = ''
install -Dm644 ../udev/99-btd700.rules -t $out/lib/udev/rules.d/

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

The udev rules source path ../udev/99-btd700.rules is tied to the CMake build directory layout (e.g., $sourceRoot/build). This is brittle and can break if the build directory changes; prefer referencing the source via $src/$sourceRoot (or ${./udev/99-btd700.rules}) so the path is stable.

Suggested change
install -Dm644 ../udev/99-btd700.rules -t $out/lib/udev/rules.d/
install -Dm644 ${./udev/99-btd700.rules} -t $out/lib/udev/rules.d/

Copilot uses AI. Check for mistakes.
Comment thread flake.nix
Comment on lines +64 to +67
systemd.user.services.btd700d = {
wantedBy = [ "default.target" ];
enable = true;
};

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

systemd.user.services.btd700d is enabled without defining serviceConfig.ExecStart/script (or another mechanism) to actually start the daemon. Unless NixOS is meant to enable a unit file provided by systemd.user.packages, this will produce an incomplete unit and fail to start. Either define the unit contents here (ExecStart pointing at ${pkg}/bin/btd700d) or install the packaged user unit via the appropriate systemd.user.packages/unit-enabling pattern.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +42 to +53
# nix
inputs = {
btd700ctl = {
url = "github:sobalap/btd700ctl";
inputs.nixpkgs.follows = "nixpkgs";
};
}

modules = [
inputs.btd700ctl.nixosModules.default
]

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

The new Nix configuration snippet is inside a ```bash code block and is not valid Nix as written (missing trailing semicolons like inputs = { ... }; / `modules = [ ... ];`). Move it to a dedicated `nix` (or untyped) fenced block and make the snippet syntactically correct so users can copy/paste it.

Copilot uses AI. Check for mistakes.
@sobalap

sobalap commented Apr 20, 2026

Copy link
Copy Markdown
Owner

@dzuberi can you address these comments? I'm not particularly familiar with Nix, but they seem reasonable enough for me to care

sobalap and others added 2 commits June 9, 2026 16:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants