about summary refs log tree commit diff
path: root/modules/nixos/psd.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/nixos/psd.nix
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to '')
-rw-r--r--modules/nixos/psd.nix65
1 files changed, 34 insertions, 31 deletions
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";
       };

Consider giving Nix/NixOS a try! <3