Skip to content
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

overseerr: init at 1.33.2 #278526

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

overseerr: init at 1.33.2 #278526

wants to merge 2 commits into from

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jan 3, 2024

Description of changes

First time packaging a node app, based myself more or less on jellyseerr (which is a fork of overseerr).

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@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 3, 2024
@caarlos0 caarlos0 force-pushed the overseerr branch 2 times, most recently from 5ec133a to c920d5a Compare January 3, 2024 18:10
@h7x4 h7x4 added the 8.has: module (new) This PR adds a module in `nixos/` label Jan 3, 2024
@h7x4
Copy link
Member

h7x4 commented Jan 18, 2024

Haven't looked to closely yet, but maybe there's something to take away from #232915?

Closes #135885

Comment on lines 37 to 40
WorkingDirectory = "${pkgs.overseerr}/libexec/overseerr/deps/overseerr";
DynamicUser = true;
ExecStart = "${pkgs.overseerr}/bin/overseerr";
BindPaths = [ "/var/lib/overseerr/:${pkgs.overseerr}/libexec/overseerr/deps/overseerr/config/" ];
Copy link
Member

Choose a reason for hiding this comment

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

What's going on here? Does it expect read and write config in libexec?

In that case, I think it would warrant patching the package. Packages are supposed to be usable outside of nixos as well, and I wouldn't really consider packages that requires bindmounts into the nix store to be in a working condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's been a while and I don't remember it that well, but I think it does require writing to that dir, yes.

It seems like we can set a CONFIG_DIRECTORY environment variable... what's the recommended thing to do here? Ask the user where to put it?

@fsnkty
Copy link
Member

fsnkty commented Feb 6, 2024

lib.mdDoc is now just an alias and can be safely entirely removed here.
see d36f950 and #237557

@eclairevoyant
Copy link
Contributor

@ofborg eval

pkgs/servers/overseerr/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/overseerr.nix Show resolved Hide resolved
nixos/modules/services/misc/overseerr.nix Outdated Show resolved Hide resolved
@eclairevoyant eclairevoyant added the 2.status: work-in-progress This PR isn't done label Feb 6, 2024
Copy link
Contributor

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

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

In addition to the feedback below, please rebase into 2 commits, one which adds the package, and a second which adds the module.

Additionally for the second commit, would be good to have the following:

Added a release notes entry if adding a new NixOS module

pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
pkgs/servers/overseerr/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/overseerr.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/overseerr.nix Outdated Show resolved Hide resolved
pkgs/by-name/ov/overseerr/package.nix Show resolved Hide resolved
Copy link
Contributor

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

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

On second reading, the previous feedback re: mdDoc and mkEnableOption may have been confusing - providing what I was looking for here.

pkgs/by-name/ov/overseerr/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ov/overseerr/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ov/overseerr/package.nix Outdated Show resolved Hide resolved
nixos/doc/manual/release-notes/rl-2405.section.md Outdated Show resolved Hide resolved
@caarlos0 caarlos0 force-pushed the overseerr branch 2 times, most recently from 37252c8 to 3eb88fb Compare February 8, 2024 19:18
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@caarlos0
Copy link
Member Author

I think all the points were addressed... I can rebase on master if you think it's good to go...

1 similar comment
@caarlos0
Copy link
Member Author

I think all the points were addressed... I can rebase on master if you think it's good to go...

@fsnkty
Copy link
Member

fsnkty commented Apr 19, 2024

I think all the points were addressed... I can rebase on master if you think it's good to go...

it won't be merged regardless if there's a merge conflict right? seems like it'd be a good idea to solve preemptively regardless

Signed-off-by: Carlos Alexandro Becker <[email protected]>
Signed-off-by: Carlos Alexandro Becker <[email protected]>
@caarlos0
Copy link
Member Author

fair, done @nu-nu-ko

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 22, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 3, 2024
@jf-uu
Copy link

jf-uu commented Sep 9, 2024

I ended up adding dataDir and user/group options in my local version of this - it'd be nice to see these supported:

--- /dev/fd/63	2024-09-09 21:03:59.746049505 +0100
+++ modules/services/misc/overseerr.nix	2024-09-09 21:03:58.179092709 +0100
@@ -18,21 +18,44 @@
       default = 5055;
       description = ''The port which the Overseerr web UI should listen to.'';
     };
+
+    dataDir = lib.mkOption {
+      type = lib.types.str;
+      default = "/var/lib/overseerr";
+      description = lib.mdDoc "The directory where Overseerr stores its data files.";
+    };
+
+    user = lib.mkOption {
+      type = lib.types.str;
+      default = "overseerr";
+      description = lib.mdDoc "User account under which Overseerr runs.";
+    };
+
+    group = lib.mkOption {
+      type = lib.types.str;
+      default = "overseerr";
+      description = lib.mdDoc "Group under which Overseerr runs.";
+    };
   };
 
   config = lib.mkIf cfg.enable {
+    systemd.tmpfiles.settings."10-overseerr".${cfg.dataDir}.d = {
+      inherit (cfg) user group;
+      mode = "0700";
+    };
+
     systemd.services.overseerr = {
       description = "Request management and media discovery tool for the Plex ecosystem";
       after = [ "network.target" ];
       wantedBy = [ "multi-user.target" ];
-      environment.PORT = toString cfg.port;
+      environment = {
+        CONFIG_DIRECTORY = cfg.dataDir;
+        PORT = toString cfg.port;
+      };
       serviceConfig = {
         Type = "exec";
-        StateDirectory = "overseerr";
         WorkingDirectory = "${cfg.package}/libexec/overseerr/deps/overseerr";
-        DynamicUser = true;
         ExecStart = lib.getExe cfg.package;
-        BindPaths = [ "/var/lib/overseerr/:${cfg.package}/libexec/overseerr/deps/overseerr/config/" ];
         Restart = "on-failure";
         ProtectHome = true;
         ProtectSystem = "strict";
@@ -49,11 +72,26 @@
         RestrictSUIDSGID = true;
         RemoveIPC = true;
         PrivateMounts = true;
+        ReadWritePaths = [ cfg.dataDir ];
+        User = cfg.user;
+        Group = cfg.group;
       };
     };
 
     networking.firewall = lib.mkIf cfg.openFirewall {
       allowedTCPPorts = [ cfg.port ];
     };
+
+    users.users = lib.mkIf (cfg.user == "overseerr") {
+      overseerr = {
+        group = cfg.group;
+        home = cfg.dataDir;
+        uid = config.ids.uids.overseerr;
+      };
+    };
+
+    users.groups = lib.mkIf (cfg.group == "overseerr") {
+      overseerr.gid = config.ids.gids.overseerr;
+    };
   };
 }

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 2.status: work-in-progress This PR isn't done 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants