syncthing: merge qsyncthingtray into the module

This commit is contained in:
Nikita Uvarov 2018-01-21 21:24:48 +01:00 committed by Robert Helgesson
parent 21fefbc8f6
commit a597c66afe
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
4 changed files with 61 additions and 52 deletions

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, options, pkgs, ... }:
with lib;
@ -534,9 +534,13 @@ in
}
{
time = "2018-01-20T10:36:12+00:00";
time = "2018-01-25T11:35:08+00:00";
condition = options.services.qsyncthingtray.enable.isDefined;
message = ''
A new module is available: 'services.qsyncthingtray'
'services.qsyncthingtray' has been merged into 'services.syncthing'.
Please, use 'services.syncthing.tray' option to activate the tray service.
The old module will be removed on February 25, 2018.
'';
}
];

View file

@ -53,7 +53,6 @@ let
./services/owncloud-client.nix
./services/parcellite.nix
./services/polybar.nix
./services/qsyncthingtray.nix
./services/random-background.nix
./services/redshift.nix
./services/screen-locker.nix

View file

@ -1,29 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
{
options = {
services.qsyncthingtray = {
enable = mkEnableOption "QSyncthingTray";
};
};
config = mkIf config.services.qsyncthingtray.enable {
systemd.user.services.qsyncthingtray = {
Unit = {
Description = "QSyncthingTray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
};
};
};
}

View file

@ -3,32 +3,67 @@
with lib;
{
imports = [
(mkRenamedOptionModule
[ "services" "qsyncthingtray" "enable" ]
[ "services" "syncthing" "tray" ])
];
meta.maintainers = [ maintainers.rycee ];
options = {
services.syncthing = {
enable = mkEnableOption "Syncthing continuous file synchronization";
};
};
config = mkIf config.services.syncthing.enable {
systemd.user.services.syncthing = {
Unit = {
Description = "Syncthing - Open Source Continuous File Synchronization";
Documentation = "man:syncthing(1)";
After = [ "network.target" ];
};
Service = {
ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
Restart = "on-failure";
SuccessExitStatus = [ 3 4 ];
RestartForceExitStatus = [ 3 4 ];
};
Install = {
WantedBy = [ "default.target" ];
tray = mkOption {
type = types.bool;
default = false;
description = "Whether to enable QSyncthingTray service.";
};
};
};
config = mkIf config.services.syncthing.enable (mkMerge [
{
systemd.user.services = {
syncthing = {
Unit = {
Description = "Syncthing - Open Source Continuous File Synchronization";
Documentation = "man:syncthing(1)";
After = [ "network.target" ];
};
Service = {
ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
Restart = "on-failure";
SuccessExitStatus = [ 3 4 ];
RestartForceExitStatus = [ 3 4 ];
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
}
(mkIf config.services.syncthing.tray {
systemd.user.services = {
qsyncthingtray = {
Unit = {
Description = "QSyncthingTray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
})
]);
}