0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-19 08:31:01 +03:00
nixpkgs/nixos/modules/services/desktops/profile-sync-daemon.nix
Silvan Mosberger d9d87c5196 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
      --argstr baseRev 0128fbb0a5
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:29:24 +01:00

97 lines
2.4 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.psd;
in
{
options.services.psd = with lib.types; {
enable = lib.mkOption {
type = bool;
default = false;
description = ''
Whether to enable the Profile Sync daemon.
'';
};
resyncTimer = lib.mkOption {
type = str;
default = "1h";
example = "1h 30min";
description = ''
The amount of time to wait before syncing browser profiles back to the
disk.
Takes a systemd.unit time span. The time unit defaults to seconds if
omitted.
'';
};
};
config = lib.mkIf cfg.enable {
systemd = {
user = {
services = {
psd = {
enable = true;
description = "Profile Sync daemon";
wants = [ "psd-resync.service" ];
wantedBy = [ "default.target" ];
path = with pkgs; [
rsync
kmod
gawk
nettools
util-linux
profile-sync-daemon
];
unitConfig = {
RequiresMountsFor = [ "/home/" ];
};
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon sync";
ExecStop = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon unsync";
};
};
psd-resync = {
enable = true;
description = "Timed profile resync";
after = [ "psd.service" ];
wants = [ "psd-resync.timer" ];
partOf = [ "psd.service" ];
wantedBy = [ "default.target" ];
path = with pkgs; [
rsync
kmod
gawk
nettools
util-linux
profile-sync-daemon
];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon resync";
};
};
};
timers.psd-resync = {
description = "Timer for profile sync daemon - ${cfg.resyncTimer}";
partOf = [
"psd-resync.service"
"psd.service"
];
timerConfig = {
OnUnitActiveSec = "${cfg.resyncTimer}";
};
};
};
};
};
}