Skip to content

nixos/fishnet: init#209181

Open
OlivierMarty wants to merge 2 commits intoNixOS:masterfrom
OlivierMarty:fishnet
Open

nixos/fishnet: init#209181
OlivierMarty wants to merge 2 commits intoNixOS:masterfrom
OlivierMarty:fishnet

Conversation

@OlivierMarty
Copy link
Copy Markdown
Contributor

Description of changes

Adds a module to run fishnet, a distributed Stockfish analysis for lichess.org.

Fixes #110678.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 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/` labels Jan 5, 2023
@OlivierMarty OlivierMarty force-pushed the fishnet branch 2 times, most recently from 98f7072 to 91ac193 Compare January 5, 2023 15:26
@ofborg ofborg bot added 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. labels Jan 5, 2023
@h7x4 h7x4 added the 8.has: module (new) This PR adds a module in `nixos/` label Oct 23, 2023
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This must be done in a separate commit, as per CONTRIBUTING.md

When adding yourself as maintainer, in the same pull request, make a separate commit with the message maintainers: add <handle>. Add the commit before those making changes to the package or module

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I fixed the PR.

@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 12, 2024
@OlivierMarty OlivierMarty force-pushed the fishnet branch 2 times, most recently from 1036578 to b4d86cf Compare February 12, 2024 22:56
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 12, 2024
@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Mar 9, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 27, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 1, 2025
@nixpkgs-ci nixpkgs-ci bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 25, 2025
@nixpkgs-ci nixpkgs-ci bot added 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` and removed 2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 12.first-time contribution This PR is the author's first one; please be gentle! labels Sep 16, 2025
@OlivierMarty OlivierMarty force-pushed the fishnet branch 2 times, most recently from 1404a76 to 7acfc15 Compare September 16, 2025 20:47
@OlivierMarty
Copy link
Copy Markdown
Contributor Author

I rebased this PR. It's ready again to be merged, if someone can approve.

Thanks.

Copy link
Copy Markdown
Member

@maevii maevii left a comment

Choose a reason for hiding this comment

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

Wow this is an old PR, I'm surprised it's gotten so little attention. Few minor things, otherwise it looks good. I wasn't able to actually test the module since I don't have a key (and don't want to apply for one), but the documented options & config format match upstream's.

New modules should also be added to the release notes.

mkKeyValue = k: v: if v == null then "" else lib.generators.mkKeyValueDefault { } "=" k v;
};
in
with lib;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

with lib; shouldn't be used, #208242

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Thanks for the review!

Comment on lines +109 to +111
let
stateDirectory = "fishnet";
in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel like this should be customizable, including the /var/lib prefix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's necessary in /var/lib if we want to leverage systemd managing the directory: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#RuntimeDirectory=

I know some modules handle paths in or out of /var/lib/ differently, but this seems overkill here.
I can make the base name customizable though.

What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You're right, grepping through the repo most of the modules seem to also hardcode their state dirs. Some do have options for changing it, but it's probably not necessary here.

I'd still probably hardcode it directly instead of using the let though, since it's pretty much guaranteed not to change and most other modules also just set it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I kept the variable to not repeat myself.

type = types.submodule {
freeformType = format.type;

options.Fishnet = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Running fishnet configure seems to output all-lowercase options, if the config is case insensitive I'd probably document everything either in all lowercase (to match upstream) or in camelCase (to match most other NixOS options).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done with all in lowercase.

@nixpkgs-ci nixpkgs-ci bot added 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation labels Nov 12, 2025
Copy link
Copy Markdown
Member

@maevii maevii left a comment

Choose a reason for hiding this comment

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

Few more things I missed the first time around, sorry. Other than that everything LGTM.

};

assertions = lib.singleton {
assertion = (cfg.settings.fishnet.key == null) != (cfg.keyfile == null);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about the case where neither are set? Assertions/warnings should also be defined at the top of config rather than the bottom.

Suggested change
assertion = (cfg.settings.fishnet.key == null) != (cfg.keyfile == null);
assertion = cfg.settings.fishnet.key != null || cfg.keyfile != null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved the assertion.

I believe it was correct though, I test that exactly one of key or keyfile is not null. My version is an exclusive or (!= for booleans is XOR) while yours is a regular or which would allow both options to be set.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You're absolutely right, sorry! Somehow I forgot for a second that assertions work the opposite from warnings (true != true -> false, which is correct here but wouldn't be in a warning), then remembered that when I was making the suggestion, but also forgot both options can't be set at the same time.

Sorry again, thanks for calling me out. Think I need more sleep...


format = pkgs.formats.ini {
# Skip null values.
mkKeyValue = k: v: if v == null then "" else lib.generators.mkKeyValueDefault { } "=" k v;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
mkKeyValue = k: v: if v == null then "" else lib.generators.mkKeyValueDefault { } "=" k v;
mkKeyValue = k: v: lib.optionalString (v != null) (lib.generators.mkKeyValueDefault { } "=" k v);

Very much a nitpick, but since you use optionalString in ExecStart I think this would be better for consistency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Member

@maevii maevii left a comment

Choose a reason for hiding this comment

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

Alright, everything looks good to me now.

Requesting @SuperSandro2000 for review/merge, since this PR is almost 3 years old and would probably slip under the radar otherwise.

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Nov 14, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: module (new) This PR adds a module in `nixos/` 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: 2 This PR was reviewed and approved by two persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fishnet

6 participants