Skip to content

rclone: add serve options#8986

Open
itzTheMeow wants to merge 1 commit intonix-community:masterfrom
itzTheMeow:rcloneserve
Open

rclone: add serve options#8986
itzTheMeow wants to merge 1 commit intonix-community:masterfrom
itzTheMeow:rcloneserve

Conversation

@itzTheMeow
Copy link
Copy Markdown
Contributor

@itzTheMeow itzTheMeow commented Mar 28, 2026

Description

Adds support for rclone serve in a similar way to the mounts.
I pretty much copied the mounts and modified it slightly since both commands are pretty similar, mountpoint is just replaced with the protocol to serve on.

The unit tests I was unable to get running, even on master. Possibly related to #8114? I did add some however.
I tested this manually with an HTTP serve on my machine and it works as intended.

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted nixf-diagnose --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@home-manager-ci home-manager-ci bot requested a review from ttrssreal March 28, 2026 07:20
Comment on lines +18 to +25
type = lib.types.nullOr (
lib.types.enum [
"ERROR"
"NOTICE"
"INFO"
"DEBUG"
]
);
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.

No need for nullOr:

Suggested change
type = lib.types.nullOr (
lib.types.enum [
"ERROR"
"NOTICE"
"INFO"
"DEBUG"
]
);
type = lib.types.enum [
null
"ERROR"
"NOTICE"
"INFO"
"DEBUG"
];

Comment on lines +29 to +30
Set the log-level.
See: https://rclone.org/docs/#logging
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
Set the log-level.
See: https://rclone.org/docs/#logging
Set the log level. See <https://rclone.org/docs/#logging> for more.

Comment on lines +227 to +228
The protocol to serve this path using.
See: https://rclone.org/commands/rclone_serve
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
The protocol to serve this path using.
See: https://rclone.org/commands/rclone_serve
The protocol to use when serve this path.
See <https://rclone.org/commands/rclone_serve> for more.

example = "http";
};

autoServe = lib.mkEnableOption "automatic serving" // {
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 believe autoStart is a more common nomenclature.

Suggested change
autoServe = lib.mkEnableOption "automatic serving" // {
autoStart = lib.mkEnableOption "automatic serving" // {

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.

Also the description is pretty unclear. Should be expanded a bit to make it clear it will cause the service to start on login.

);

serveServices = lib.listToAttrs (
lib.concatMap
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.

This code is completely unclear and definitely needs to be refactored into some more understandable form.

@@ -0,0 +1,81 @@
{ pkgs, 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.

While it is very nice you added an integration test I would suggest to also add a unit test that verifies that the expected service files are created. Since integration tests are not typically run in CI we would otherwise easily miss regressions.

@rycee
Copy link
Copy Markdown
Member

rycee commented Mar 31, 2026

Thanks for the contribution, I've added some comments.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants