From 9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 31 Mar 2024 21:29:27 +0300 Subject: 2024-03-31 --- modules/nixos/psd.nix | 65 +++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'modules/nixos/psd.nix') diff --git a/modules/nixos/psd.nix b/modules/nixos/psd.nix index eb5a1a8..f974af2 100644 --- a/modules/nixos/psd.nix +++ b/modules/nixos/psd.nix @@ -4,15 +4,16 @@ pkgs, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.psd; -in { - options.nixfiles.modules.psd.enable = - mkEnableOption "Profile Sync Daemon"; +in +{ + options.nixfiles.modules.psd.enable = mkEnableOption "Profile Sync Daemon"; config = mkIf cfg.enable { hm = { - home.packages = with pkgs; [profile-sync-daemon]; + home.packages = with pkgs; [ profile-sync-daemon ]; xdg.configFile."psd/psd.conf".text = '' USE_OVERLAYFS="yes" @@ -20,40 +21,42 @@ in { }; systemd.user = { - services = let - exe = getExe' pkgs.profile-sync-daemon "profile-sync-daemon"; - in { - psd = { - unitConfig = { - Description = "Profile-sync-daemon"; - Wants = ["psd-resync.service"]; - RequiresMountsFor = "/home/"; - After = ["local-fs.target"]; - }; - serviceConfig = { - RemainAfterExit = true; - ExecStart = "${exe} startup"; - ExecStop = "${exe} unsync"; + services = + let + exe = getExe' pkgs.profile-sync-daemon "profile-sync-daemon"; + in + { + psd = { + unitConfig = { + Description = "Profile-sync-daemon"; + Wants = [ "psd-resync.service" ]; + RequiresMountsFor = "/home/"; + After = [ "local-fs.target" ]; + }; + serviceConfig = { + RemainAfterExit = true; + ExecStart = "${exe} startup"; + ExecStop = "${exe} unsync"; + }; + wantedBy = [ "graphical.target" ]; }; - wantedBy = ["graphical.target"]; - }; - psd-resync = { - unitConfig = { - Description = "Profile-sync-daemon resync"; - After = ["psd.service"]; - Wants = ["psd-resync.timer"]; - BindsTo = ["psd.service"]; + psd-resync = { + unitConfig = { + Description = "Profile-sync-daemon resync"; + After = [ "psd.service" ]; + Wants = [ "psd-resync.timer" ]; + BindsTo = [ "psd.service" ]; + }; + serviceConfig.ExecStart = "${exe} resync"; + wantedBy = [ "graphical.target" ]; }; - serviceConfig.ExecStart = "${exe} resync"; - wantedBy = ["graphical.target"]; }; - }; timers.psd-resync = { unitConfig = { Description = "Profile-sync-daemon resync timer"; - BindsTo = ["psd.service"]; + BindsTo = [ "psd.service" ]; }; timerConfig.OnUnitActiveSec = "1h"; }; -- cgit 1.4.1