-
-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provides a service to prune the Rosetta 2 JIT bytecode cache.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
config, | ||
lib, | ||
... | ||
}: | ||
|
||
let | ||
inherit (lib) | ||
mkEnableOption | ||
mkIf | ||
mkOption | ||
; | ||
|
||
launchdTypes = import ../../launchd/types.nix { inherit config lib; }; | ||
|
||
cfg = config.rosetta2-gc; | ||
in | ||
|
||
{ | ||
options.rosetta2-gc = { | ||
enable = mkEnableOption "Rosetta 2 JIT cache garbage collection"; | ||
|
||
interval = mkOption { | ||
type = launchdTypes.StartCalendarInterval; | ||
default = [ | ||
{ | ||
Weekday = 6; | ||
Hour = 3; | ||
Minute = 15; | ||
} | ||
]; | ||
description = '' | ||
The calendar interval at which the garbage collector will run. | ||
See the {option}`serviceConfig.StartCalendarInterval` option of | ||
the {option}`launchd` module for more info. | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
launchd.daemons.rosetta2-gc = { | ||
command = "/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -P -minsize 0 /System/Volumes/Data"; | ||
serviceConfig = { | ||
RunAtLoad = true; | ||
StartCalendarInterval = cfg.interval; | ||
StandardErrorPath = "/var/log/rosetta2-gc.log"; | ||
StandardOutPath = "/var/log/rosetta2-gc.log"; | ||
}; | ||
}; | ||
}; | ||
} |