Personal Nix setup
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 44 lines 1.2 kB view raw
1{ lib, config, helpers, ... }: 2 3with lib; 4let 5 cfg = config.modules.vram; 6 7 setWiredLimitMb = optionalString (cfg.wiredLimit != null) '' 8 wired_memsize_mb=$(($(sysctl -n hw.memsize) / 1024 / 1024)) 9 sysctl -w iogpu.wired_limit_mb="$((wired_memsize_mb - ${toString (cfg.wiredLimit * 1024)}))" 10 ''; 11 setWiredLowWaterMarkMb = optionalString (cfg.wiredLowWatermark != null) '' 12 sysctl -w iogpu.wired_lwm_mb="$((${toString (cfg.wiredLowWatermark * 1024)}))" 13 ''; 14in helpers.darwinAttrs { 15 options.modules.vram = { 16 wiredLimit = mkOption { 17 default = null; 18 description = "Wired Memory Limit in GBs"; 19 type = types.nullOr (types.ints.between 2 512); 20 }; 21 22 wiredLowWatermark = mkOption { 23 default = null; 24 description = "Wired LWM (Low Watermark) in GBs"; 25 type = types.nullOr (types.ints.between 2 512); 26 }; 27 }; 28 29 config = mkIf (cfg.wiredLimit != null || cfg.wiredLowWatermark != null) { 30 system.activationScripts.postActivation.text = '' 31 ${setWiredLimitMb} 32 ${setWiredLowWaterMarkMb} 33 ''; 34 35 launchd.daemons."sysctl-wired-limit" = { 36 serviceConfig.RunAtLoad = true; 37 script = '' 38 ${setWiredLimitMb} 39 ${setWiredLowWaterMarkMb} 40 ''; 41 }; 42 }; 43} 44