megasync: add module

This commit is contained in:
Gaetan Lepage 2022-12-06 17:21:08 +01:00 committed by Robert Helgesson
parent e412025fff
commit 0e9e86b179
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
4 changed files with 51 additions and 0 deletions

2
.github/CODEOWNERS vendored
View File

@ -427,6 +427,8 @@ Makefile @thiagokokada
/modules/services/mbsync.nix @pjones
/modules/services/megasync.nix @GaetanLepage
/modules/services/mopidy.nix @foo-dogsquared
/tests/modules/services/mopidy @foo-dogsquared

View File

@ -853,6 +853,14 @@ in
'Host' blocks
'';
}
{
time = "2022-12-16T15:01:20+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.megasync'.
'';
}
];
};
}

View File

@ -238,6 +238,7 @@ let
./services/lorri.nix
./services/mako.nix
./services/mbsync.nix
./services/megasync.nix
./services/mopidy.nix
./services/mpd.nix
./services/mpdris2.nix

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.megasync;
in {
meta.maintainers = [ maintainers.GaetanLepage ];
options = {
services.megasync = {
enable = mkEnableOption "Megasync client";
package = mkPackageOption pkgs "megasync" { };
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.megasync" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.megasync = {
Unit = {
Description = "megasync";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = { ExecStart = "${cfg.package}/bin/megasync"; };
};
};
}