2019-04-19 03:11:51 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
with lib;
|
|
|
|
|
let cfg = config.niveum.google-drive;
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
options.niveum.google-drive = {
|
|
|
|
|
enable = mkEnableOption "Google Drive";
|
|
|
|
|
directory = mkOption { type = types.path; };
|
|
|
|
|
user = mkOption { type = types.attrs; };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
environment.systemPackages = [
|
|
|
|
|
pkgs.grive2
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
systemd.services.google-drive = {
|
|
|
|
|
description = "Google Drive synchronisation service";
|
2019-05-15 18:23:13 +02:00
|
|
|
after = [ "network-online.target" ];
|
2019-06-08 15:01:55 +02:00
|
|
|
script = "${pkgs.grive2}/bin/grive -p ${cfg.directory}";
|
2019-04-19 03:11:51 +02:00
|
|
|
startAt = "*:0/5";
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Type = "oneshot";
|
|
|
|
|
User = cfg.user.name;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|