-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
nixos/bitbox-bridge: init #392817
base: master
Are you sure you want to change the base?
nixos/bitbox-bridge: init #392817
Conversation
8a1a31f
to
370ced5
Compare
0143e4c
to
4b24603
Compare
@JohnRTitor @HeitorAugustoLN @ethancedwards8 @SuperSandro2000 This PR is ready for review. I've specifically also manually tested |
runOnMount = lib.mkOption { | ||
type = lib.types.bool; | ||
default = false; | ||
description = '' | ||
Enable running bitbox-bridge.service only when hardware wallet is plugged, also registers the systemd device unit. When false, bitbox-bridge service runs all the time. | ||
''; | ||
}; |
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.
runOnMount = lib.mkOption { | |
type = lib.types.bool; | |
default = false; | |
description = '' | |
Enable running bitbox-bridge.service only when hardware wallet is plugged, also registers the systemd device unit. When false, bitbox-bridge service runs all the time. | |
''; | |
}; | |
runOnMount = lib.mkEnableOption '' | |
running bitbox-bridge.service only when hardware wallet is plugged, also registers the systemd device unit. | |
When false, bitbox-bridge service runs all the time''; |
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.
I've changed the logic to make services.bitbox-bridge.runOnMount = true
by default, seems like a better default to conserve power/battery. Let me know if you still think we should change it ;)
4b24603
to
7bdef6d
Compare
7bdef6d
to
6b7ba8b
Compare
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.
Rest LGTM:
Commit messages need updating though:
- nixosTests/bitbox-bridge: init
- This isn't really needed, AFAIK services.udev.package will still pickup the rules from
lib
fine. But don't just take my word for it, you can verify the path yourself. - nixos/bitbox-bridge: init
- Can be merged with the above commit
runOnMount = lib.mkOption { | ||
type = lib.types.bool; | ||
default = true; | ||
example = false; | ||
description = '' | ||
Run bitbox-bridge.service only when hardware wallet is plugged, also registers the systemd device unit. | ||
This option is enabled by default to save power, when false, bitbox-bridge service runs all the time instead. | ||
'';; | ||
}; |
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.
I was typing a review comment for this, exactly when you updated :)
So as you can see using mkEnableOption
auto appends stuff:
Whether to enable Run bitbox-bridge.service only.....
You want something like this instead:
runOnMount = lib.mkOption { | |
type = lib.types.bool; | |
default = true; | |
example = false; | |
description = '' | |
Run bitbox-bridge.service only when hardware wallet is plugged, also registers the systemd device unit. | |
This option is enabled by default to save power, when false, bitbox-bridge service runs all the time instead. | |
'';; | |
}; | |
runOnMount = lib.mkEnableOption null // { | |
default = true; | |
description = '' | |
Run bitbox-bridge.service only when hardware wallet is plugged, also registers the systemd device unit. | |
This option is enabled by default to save power, when false, bitbox-bridge service runs all the time instead. | |
''; | |
}; |
You can check how it looks by downloading the artifact from our CI NixOS manal build then looking at the options.html.
Or you can build the manual yourself:
nix build --print-out-paths ".#htmlDocs.nixosManual.x86_64-linux"
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.
I've changed the logic to make services.bitbox-bridge.runOnMount = true
by default, seems like a better default to conserve power/battery. Let me know if you still think we should change it ;)
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.
Please use mkEnableOption. You can still enable it by default by setting the override, just like how I did.
17aa843
to
056970d
Compare
@HeitorAugustoLN @JohnRTitor requested changes are done.
@JohnRTitor I've specifically made this change after testing it on my NixOS machine and another archlinux machine that runs with nix. The other way created some issues as far as I remember. Please let me know below any other changes needed. Thanks! ;) |
056970d
to
5f50221
Compare
Right. NixOS module system knows that we should install udev rules to |
@JohnRTitor Yes I think I couldn't also get it working in NixOS because the /lib udev rules don't get copied to /etc/udev and applied as rules. So instead of duplicating the logic I decided to move it to |
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.
Just add a release note and we are good.
5f50221
to
bfe4696
Compare
Not sure if I added to the right release note(s), but I guess its done now! :) 🎉 |
Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
bfe4696
to
2aeb633
Compare
LGTM, but looks like I forgot to tell you to add I'll do it myself and then merge. |
nixos tests and nix-update-script added Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
|
This PR adds
config.services.bitbox-bridge
to NixOS.Previous PR could be found here: #391415
Things done
Adds the most basic service configuration for
config.services.bitbox-bridge
.Adds a nix test to check
bitbox-bridge
can be built & run.Adds
config.services.bitbox-bridge.runOnMount
to run the systemd service only on mount. It does proper systemd device unit registration when hardware wallet is plugged via udev.Built on platform(s)
Tested basic functionality of all binary files (usually in
./result/bin/
)Fits CONTRIBUTING.md.