mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-09 10:31:06 +01:00
syncthing: merge qsyncthingtray into the module
This commit is contained in:
parent
21fefbc8f6
commit
a597c66afe
4 changed files with 61 additions and 52 deletions
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue