mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 06:19:00 +00:00
services/distant: add Distant server daemon
Because of this, the manager and the server services should be opted in to be enabled.
This commit is contained in:
parent
d421591105
commit
3d10612e9b
@ -11,7 +11,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.distant = {
|
options.services.distant = {
|
||||||
enable = lib.mkEnableOption "Distant manager";
|
enable = lib.mkEnableOption "Distant-related services";
|
||||||
|
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
description = lib.mkDoc "The package containing the `distant` executable.";
|
description = lib.mkDoc "The package containing the `distant` executable.";
|
||||||
@ -33,10 +33,13 @@ in
|
|||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
manager.enable = lib.mkEnableOption "Distant manager daemon";
|
||||||
|
server.enable = lib.mkEnableOption "Distant server daemon";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
systemd.user.services.distant-manager = {
|
systemd.user.services.distant-manager = lib.mkIf cfg.manager.enable {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Distant manager daemon";
|
Description = "Distant manager daemon";
|
||||||
Documentation = [ "https://distant.dev" ];
|
Documentation = [ "https://distant.dev" ];
|
||||||
@ -47,13 +50,12 @@ in
|
|||||||
${lib.getBin cfg.package}/bin/distant manager listen --config ${settingsFile} ${lib.optionalString (!hasCustomSocketPath) "--unix-socket ${defaultSocketPath}"}
|
${lib.getBin cfg.package}/bin/distant manager listen --config ${settingsFile} ${lib.optionalString (!hasCustomSocketPath) "--unix-socket ${defaultSocketPath}"}
|
||||||
'';
|
'';
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
StandardInput = "socket";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Install.WantedBy = "default.target";
|
Install.WantedBy = "default.target";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.sockets.distant-manager = {
|
systemd.user.sockets.distant-manager = lib.mkIf cfg.manager.enable {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Distant manager daemon";
|
Description = "Distant manager daemon";
|
||||||
Documentation = [ "https://distant.dev" ];
|
Documentation = [ "https://distant.dev" ];
|
||||||
@ -61,5 +63,22 @@ in
|
|||||||
|
|
||||||
Socket.ListenStream = if hasCustomSocketPath then cfg.settings.manager.unix_socket else defaultSocketPath;
|
Socket.ListenStream = if hasCustomSocketPath then cfg.settings.manager.unix_socket else defaultSocketPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.user.services.distant-server = lib.mkIf cfg.server.enable {
|
||||||
|
Unit = {
|
||||||
|
Description = "Distant manager daemon";
|
||||||
|
Documentation = [ "https://distant.dev" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = ''
|
||||||
|
${lib.getBin cfg.package}/bin/distant server listen --config ${settingsFile}
|
||||||
|
'';
|
||||||
|
Restart = "on-failure";
|
||||||
|
StandardInput = "socket";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install.WantedBy = "default.target";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user