refactor: move rm-target service and timer to separate file
This commit is contained in:
		
							parent
							
								
									4ebfaca007
								
							
						
					
					
						commit
						0f61393bf3
					
				
					 2 changed files with 27 additions and 24 deletions
				
			
		| 
						 | 
					@ -44,6 +44,7 @@
 | 
				
			||||||
    inputs.nix-index-database.hmModules.nix-index
 | 
					    inputs.nix-index-database.hmModules.nix-index
 | 
				
			||||||
    ../settings
 | 
					    ../settings
 | 
				
			||||||
    ./powerplay-led-idle.nix
 | 
					    ./powerplay-led-idle.nix
 | 
				
			||||||
 | 
					    ./rm-target.nix
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  my = import ./variables.nix // {
 | 
					  my = import ./variables.nix // {
 | 
				
			||||||
| 
						 | 
					@ -169,30 +170,6 @@
 | 
				
			||||||
        exec nicotine
 | 
					        exec nicotine
 | 
				
			||||||
      '';
 | 
					      '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  systemd.user.services.rm-target = {
 | 
					 | 
				
			||||||
    Unit = {
 | 
					 | 
				
			||||||
      Description = "Remove directories named 'target'";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    Service = {
 | 
					 | 
				
			||||||
      Type = "oneshot";
 | 
					 | 
				
			||||||
      ExecStart = pkgs.writeShellScript "rm-target" ''
 | 
					 | 
				
			||||||
        sudo ${pkgs.fd}/bin/fd -td -u '^\.?target$' "$HOME" -x rm -vrf --
 | 
					 | 
				
			||||||
      '';
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  systemd.user.timers.rm-target = {
 | 
					 | 
				
			||||||
    Unit = {
 | 
					 | 
				
			||||||
      Description = "Remove directories named 'target'";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    Timer = {
 | 
					 | 
				
			||||||
      OnCalendar = "weekly";
 | 
					 | 
				
			||||||
      Unit = "rm-target.service";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    Install = {
 | 
					 | 
				
			||||||
      WantedBy = [ "timers.target" ];
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # This value determines the Home Manager release that your
 | 
					  # This value determines the Home Manager release that your
 | 
				
			||||||
  # configuration is compatible with. This helps avoid breakage
 | 
					  # configuration is compatible with. This helps avoid breakage
 | 
				
			||||||
  # when a new Home Manager release introduces backwards
 | 
					  # when a new Home Manager release introduces backwards
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								user/rm-target.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								user/rm-target.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,26 @@
 | 
				
			||||||
 | 
					{ pkgs, lib, ... }:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  systemd.user.services.rm-target = {
 | 
				
			||||||
 | 
					    Unit = {
 | 
				
			||||||
 | 
					      Description = "Remove directories named 'target'";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    Service = {
 | 
				
			||||||
 | 
					      Type = "oneshot";
 | 
				
			||||||
 | 
					      ExecStart = pkgs.writeShellScript "rm-target" ''
 | 
				
			||||||
 | 
					        sudo ${pkgs.fd}/bin/fd -td -u '^\.?target$' "$HOME" -x rm -vrf --
 | 
				
			||||||
 | 
					      '';
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  systemd.user.timers.rm-target = {
 | 
				
			||||||
 | 
					    Unit = {
 | 
				
			||||||
 | 
					      Description = "Remove directories named 'target'";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    Timer = {
 | 
				
			||||||
 | 
					      OnCalendar = "weekly";
 | 
				
			||||||
 | 
					      Unit = "rm-target.service";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    Install = {
 | 
				
			||||||
 | 
					      WantedBy = [ "timers.target" ];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue