refactor: move rm-target service and timer to separate file
This commit is contained in:
		
							parent
							
								
									fd3c642a10
								
							
						
					
					
						commit
						e649117615
					
				
					 2 changed files with 27 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -44,6 +44,7 @@
 | 
			
		|||
    inputs.nix-index-database.hmModules.nix-index
 | 
			
		||||
    ../settings
 | 
			
		||||
    ./powerplay-led-idle.nix
 | 
			
		||||
    ./rm-target.nix
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  my = import ./variables.nix // {
 | 
			
		||||
| 
						 | 
				
			
			@ -169,30 +170,6 @@
 | 
			
		|||
        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
 | 
			
		||||
  # configuration is compatible with. This helps avoid breakage
 | 
			
		||||
  # 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