Midnight is kind of when you're still up and may want read performance that is not affected by a btrfs scrub. Change-Id: I0609269d3ee9853f7c7fe08cae18efe1d9259e7e Reviewed-on: https://cl.tvl.fyi/c/depot/+/10864 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			719 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			719 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
# Automatically performs a scrub on all btrfs filesystems configured in
 | 
						|
# `config.fileSystems` on a daily schedule (by default). Activated by importing.
 | 
						|
{ config, lib, ... }:
 | 
						|
 | 
						|
{
 | 
						|
  config = {
 | 
						|
    services = {
 | 
						|
      btrfs.autoScrub = {
 | 
						|
        enable = true;
 | 
						|
        interval = lib.mkDefault "*-*-* 03:30:00";
 | 
						|
        # gather all btrfs fileSystems, extra ones can be added via the NixOS
 | 
						|
        # module merging mechanism, of course.
 | 
						|
        fileSystems = lib.concatLists (
 | 
						|
          lib.mapAttrsToList
 | 
						|
            (
 | 
						|
              _:
 | 
						|
              { fsType, mountPoint, ... }:
 | 
						|
              if fsType == "btrfs" then [ mountPoint ] else [ ]
 | 
						|
            )
 | 
						|
            config.fileSystems
 | 
						|
        );
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |