Personal Nix setup
0
fork

Configure Feed

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

Add macos-vram helpers

+41
+4
machines/irnbru/configuration.nix
··· 4 4 imports = [ ]; 5 5 6 6 modules = { 7 + vram = { 8 + wiredLimit = 8; 9 + wiredLowWatermark = 20; 10 + }; 7 11 server = { 8 12 enable = true; 9 13 sshd.enable = true;
+1
modules/base/default.nix
··· 7 7 ./shell.nix 8 8 ./linux.nix 9 9 ./macos.nix 10 + ./macos-vram.nix 10 11 ]; 11 12 }
+36
modules/base/macos-vram.nix
··· 1 + { lib, config, helpers, ... }: 2 + 3 + with lib; 4 + let 5 + cfg = config.modules.vram; 6 + in helpers.darwinAttrs { 7 + options.modules.vram = { 8 + wiredLimit = mkOption { 9 + default = null; 10 + description = "Wired Memory Limit in GBs"; 11 + type = types.nullOr (types.ints.between 2 512); 12 + }; 13 + 14 + wiredLowWatermark = mkOption { 15 + default = null; 16 + description = "Wired LWM (Low Watermark) in GBs"; 17 + type = types.nullOr (types.ints.between 2 512); 18 + }; 19 + }; 20 + 21 + config = mkIf (cfg.wiredLimit != null || cfg.wiredLowWatermark != null) { 22 + system.activationScripts.postActivation.text = let 23 + setWiredLimitMb = optionalString (cfg.wiredLimit != null) '' 24 + wired_memsize_mb=$(($(sysctl -n hw.memsize) / 1024 / 1024)) 25 + sysctl -w iogpu.wired_limit_mb="$((wired_memsize_mb - ${toString (cfg.wiredLimit * 1024)}))" 26 + ''; 27 + setWiredLowWaterMarkMb = optionalString (cfg.wiredLowWatermark != null) '' 28 + sysctl -w iogpu.wired_lwm_mb="$((${toString (cfg.wiredLowWatermark * 1024)}))" 29 + ''; 30 + in '' 31 + ${setWiredLimitMb} 32 + ${setWiredLowWaterMarkMb} 33 + ''; 34 + }; 35 + } 36 +