-
Notifications
You must be signed in to change notification settings - Fork 4
feat: nix flake to build this on nix. #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
e5a02d6
5eb40d4
dbdfd2b
6f8bcda
a75aa31
d30810f
659a33f
373b988
9bb1e90
57095ec
4e490ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| { | ||
| description = "Unofficial linux driver for the Sennheiser BTD 700 dongle"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| }; | ||
|
|
||
| outputs = { self, nixpkgs }: | ||
| let | ||
| supportedSystems = [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ]; | ||
| forAllSystems = nixpkgs.lib.genAttrs supportedSystems; | ||
| in | ||
| { | ||
| packages = forAllSystems (system: | ||
| let | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
| in | ||
| { | ||
| default = pkgs.stdenv.mkDerivation { | ||
| pname = "btd700ctl"; | ||
| version = "unstable-${self.shortRev or "dirty"}"; | ||
|
|
||
| src = ./.; | ||
|
|
||
| nativeBuildInputs = with pkgs; [ cmake pkg-config makeWrapper ]; | ||
| buildInputs = with pkgs; [ hidapi ]; | ||
|
|
||
| postInstall = '' | ||
| install -Dm644 ../udev/99-btd700.rules $out/lib/udev/rules.d/99-btd700.rules | ||
| substituteInPlace $out/lib/systemd/user/btd700d.service \ | ||
| --replace-fail "/usr/local/bin/btd700d" "$out/bin/btd700d" | ||
| wrapProgram $out/bin/btd700d \ | ||
| --prefix PATH : ${pkgs.wireplumber}/bin | ||
| ''; | ||
|
|
||
| meta = with pkgs.lib; { | ||
| description = "Unofficial linux driver for the Sennheiser BTD 700 dongle"; | ||
| homepage = "https://github.com/sobalap/btd700ctl"; | ||
| license = licenses.lgpl21Only; | ||
| platforms = platforms.linux; | ||
| mainProgram = "btd700d"; | ||
| }; | ||
| }; | ||
| }); | ||
| nixosModules.default = { pkgs, lib, config, ... }: | ||
| let | ||
| pkg = self.packages.${pkgs.system}.default; | ||
| in { | ||
| assertions = [ | ||
| { | ||
| assertion = config.services.pipewire.enable == true; | ||
| message = "The btd700d module requires 'services.pipewire.enable = true;'"; | ||
| } | ||
| { | ||
| assertion = config.services.pipewire.wireplumber.enable == true; | ||
| message = "The btd700d module requires 'services.pipewire.wireplumber.enable = true;'"; | ||
| } | ||
| ]; | ||
|
|
||
| services.udev.packages = [ pkg ]; | ||
| environment.systemPackages = [ pkg ]; | ||
| systemd.packages = [ pkg ]; | ||
|
|
||
| systemd.user.services.btd700d = { | ||
| wantedBy = [ "default.target" ]; | ||
| enable = true; | ||
| }; | ||
|
Comment on lines
+64
to
+67
|
||
| }; | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
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.