Skip to content

Conversation

@zSuperx
Copy link

@zSuperx zSuperx commented Dec 19, 2025

This PR creates a NixOS module for bore, a TCP tunneling program. More can be read about bore here. While Bore is already packaged within nixpkgs (available at pkgs.bore-cli), its functionality can be greatly improved if integrated as a full NixOS module.

This PR creates said module, exposing options like services.bore.servers and services.bore.local. Each .<name> entry within these attribute sets corresponds to a separate systemd service running bore [local|server] ....

As for the checklist below, I have tried running nixpkgs-review, but it seems to kill my tmux terminal pane before showing any kind of useful output. I can debug & rerun it if needed for this PR. Additionally, I have not written official NixOS tests for this module yet (since I have yet to learn the necessary syntax for doing so), though I have tested the options thoroughly on my own servers. Writing the tests is something I plan on doing in the coming days (as I figure out how to do so, and also depending on the reception of this PR).

EDIT: I have written NixOS tests and ensured they are passing.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 12.first-time contribution This PR is the author's first one; please be gentle! 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Dec 19, 2025
@zSuperx zSuperx force-pushed the create-bore-nixos-module branch from a49e99b to 907b40a Compare December 19, 2025 19:59
@MattSturgeon
Copy link
Contributor

I have tried running nixpkgs-review, but it seems to kill my tmux terminal pane before showing any kind of useful output. I can debug & rerun it if needed for this PR.

nixpkgs-review builds all packages that were "changed" by a PR. You can view what was added, removed, and changed in the "eval summary" CI results. In this case:

  1. nixos-install-tools
  2. tests.nixos-functions.nixos-test

I don't think running nixpkgs-review adds any value in this case.

Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

I'm not familiar with bore and can't comment on whether you're using or configuring it correctly. I'm also not intimately familiar with NixOS systemd services. I can review general nix and module system stuff though.

I think the biggest issue is that you've decided to cleanly separate the "server" and "local" stuff into separate files. As much of the implementation is identical, this leads to a lot of duplication.

We can DRY this up by combining similar files together and explicitly handling where local/server need to be different. Or alternatively, implement "common" things in a shared file and "special" things in separate files that import the shared file.

Also, when this PR is ready to be merged (or ideally, sooner while it's being reviewed), your commits will need some cleanup. See https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions

  • Create one commit for each logical unit.
  • If you have commits pkg-name: oh, forgot to insert whitespace: squash commits in this case.
    Use git rebase -i. See Squashing Commits for additional information.

In this case that essentially means:

  1. maintainers: add zsuper
  2. nixos/services/bore: init
  3. nixos/tests/bore: init

@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Dec 21, 2025
@zSuperx
Copy link
Author

zSuperx commented Dec 23, 2025

When rebasing to squash the commits into the following:

  • maintainers: add zsuper
  • nixos/services/bore: init
  • nixos/tests/bore: init

There are a few commits that touched module files and test files. What should I do in that case?

@MattSturgeon
Copy link
Contributor

There are a few commits that touched module files and test files. What should I do in that case?

Rewriting git history can get tricky in that scenario. There are lots of fancy techniques, depending on your exact scenario and preferred workflow.

The simplest approach is to kinda start from scratch.

# Replace <base_commit> with the commit before your PR
# This will remove your commits, but keep their changes in the worktree
$ git reset --mixed <base_commit>

# Now you've reset the commits, you can re-create them...

# You can use `-p` to add individual hunks of a file
$ git add -p

# Or just add specific files or folders
$ git add nixos/tests
$ git commit -m "nixos/tests/bore: init"

# If you can copy the original commit's SHA hash,
# you can also re-use their commit message automatically,
# using --reuse-message or --reedit-message:
$ git add maintainers
$ git commit --reedit-message a9c9d68ebab918830489f8949f6a216ee215db2f

If you ever think you've lost a commit, check the git reflog.

@zSuperx
Copy link
Author

zSuperx commented Dec 23, 2025

Okay cool, that shouldn't be too bad then. And if I need to make any further changes after the fact (say another reviewer wants me to change the tests), should I just rebase those commits back into the nixos/tests commit? Or should I wait until all reviewers are done before doing the reset + recommit strategy?

@MattSturgeon
Copy link
Contributor

MattSturgeon commented Dec 23, 2025

And if I need to make any further changes after the fact (say another reviewer wants me to change the tests), should I just rebase those commits back into the nixos/tests commit? Or should I wait until all reviewers are done before doing the reset + recommit strategy?

This comes down to your personal workflow, but most reviewers will expect to see the commits rebased/amended when you make the change.

Personally, I like to use --fixup commits combined with --autosquash interactive rebases. If you're careful that your fixup commit only contains changes relevant to the commit it's fixing up, then that can be a simple workflow.

Such fixup commits can either be pushed up to the PR; they demonstrate you plan to squash the change if it is accepted. Or you can do the rebase/squash before pushing; this leaves the PR in a "merge-ready" state, which is usually best.

Another alternative approach is to use break and edit in an interactive rebase and go through and edit the changes in the actual commit; usually this means stopping the rebase at a commit and using git commit --amend to make changes, then using git rebase --continue when done.

Then there are tools like lazygit that offer an alternative workflow for doing similar things.

(I'll minimise these comments as off-topic later, so the thread isn't too noisy)

@zSuperx zSuperx force-pushed the create-bore-nixos-module branch 3 times, most recently from 1042638 to 083d33f Compare December 23, 2025 02:31
@zSuperx zSuperx requested a review from MattSturgeon December 23, 2025 02:39
@zSuperx zSuperx force-pushed the create-bore-nixos-module branch 2 times, most recently from a5634ba to 89a3d19 Compare December 30, 2025 08:22
@zSuperx zSuperx force-pushed the create-bore-nixos-module branch from 89a3d19 to 8c2fbc4 Compare January 4, 2026 20:13
Copy link
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

SGTM. Code looks well structured and robust.

I'd ideally appreciate a review from someone who deals with systemd modules more than I do, if anyone is able to review.

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 4, 2026
@zSuperx
Copy link
Author

zSuperx commented Jan 4, 2026

SGTM. Code looks well structured and robust.

Only thanks to your help! Seriously, I learned so much from this thread, thank you so much for taking the time to review! I'll be sure to use these norms & conventions for any future PRs (and general Nix code) I create :)

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

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants