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

miniflux: add service #52638

Closed
wants to merge 1 commit into from
Closed

Conversation

nornagon
Copy link
Contributor

Motivation for this change

miniflux package already exists, this adds a service

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I'm new at this! Please let me know if I've done something silly :)

type = types.package;
default = pkgs.miniflux;
defaultText = "pkgs.miniflux";
description = "Which miniflux package to use.";
Copy link
Member

Choose a reason for hiding this comment

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

If there are no alternative packages or any other good reason to have such an option, I prefer not to have it, see #50476

user = mkOption {
type = types.str;
default = "miniflux";
example = "miniflux";
Copy link
Member

Choose a reason for hiding this comment

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

No need to add an example when it's the default anyways (the default will displayed be in the docs too), same for some of the other options.

name = cfg.user;
group = cfg.group;
description = "miniflux service user";
isSystemUser = true;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

};

config = mkIf cfg.enable {
services.postgresql.enable = mkDefault true;
Copy link
Member

Choose a reason for hiding this comment

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

Why mkDefault? This service requires it to be true and it won't work if this gets overridden to be false by something else.


serviceConfig = {
PermissionsStartOnly = true;
Type = "simple";
Copy link
Member

Choose a reason for hiding this comment

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

"simple" is the default

configFile = pkgs.writeText "miniflux.conf" ''
LISTEN_ADDR=${cfg.listenAddress}:${toString cfg.listenPort}
DATABASE_URL="postgresql://${dbUser}:${dbPassword}@${dbHost}/${dbName}?sslmode=disable"
RUN_MIGRATIONS=1
Copy link
Member

Choose a reason for hiding this comment

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

Just set these variables with

{
  systemd.services.miniflux = {
    environment = {
      LISTEN_ADDR = ...;
      # ...
    };
    # ...
  };
}

PrivateTmp = false;
ExecStart = "${cfg.package}/bin/miniflux";
EnvironmentFile = configFile;
User = cfg.user;
Copy link
Member

Choose a reason for hiding this comment

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

Forgot to set the group

@bricewge bricewge mentioned this pull request Mar 2, 2019
10 tasks
@joachifm
Copy link
Contributor

Superseded by #56719

@joachifm joachifm closed this Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants