Skip to content

Storage

Source directory: modules/storage/

garbage-collection.nix

modules/storage/garbage-collection.nix

Nix Store Garbage Collection Module Automatic cleanup of old generations and unused store paths

  • Enable option: Enable automatic Nix garbage collection

Options: enable, keepGenerations, aggressiveCleanup

Options declaration (Nix)
  options.storage.garbageCollection = {
    enable = mkEnableOption "Enable automatic Nix garbage collection";

    keepGenerations = mkOption {
      type = types.int;
      default = 5;
      description = "Number of system generations to keep";
    };

    aggressiveCleanup = mkOption {
      type = types.bool;
      default = false;
      description = "Enable aggressive cleanup removing all old generations";
    };
  }

performance-optimization.nix

modules/storage/performance-optimization.nix

Storage Performance Optimization Module

  • Enable option: Enable storage performance optimization
  • Enable option: Enable filesystem optimization
  • Enable option: Enable tmpfs optimization for performance

Options: enable, profile, cacheOptimization, tmpSize, varTmpSize, devShmSize

Options declaration (Nix)
  options.storage.performanceOptimization = {
    enable = mkEnableOption "Enable storage performance optimization";

    profile = mkOption {
      type = types.enum [ "performance" "balanced" "reliability" ];
      default = "balanced";
      description = "Storage optimization profile";
    };

    filesystemOptimization = {
      enable = mkEnableOption "Enable filesystem optimization";

      cacheOptimization = mkOption {
        type = types.bool;
        default = true;
        description = "Enable filesystem cache optimization";
      };
    };

    tmpfsOptimization = {
      enable = mkEnableOption "Enable tmpfs optimization for performance";

      tmpSize = mkOption {
        type = types.str;
        default = "2G";
        description = "Size of /tmp tmpfs";
      };

      varTmpSize = mkOption {
        type = types.str;
        default = "1G";
        description = "Size of /var/tmp tmpfs";
      };

      devShmSize = mkOption {
        type = types.str;
        default = "50%";
        description = "Size of /dev/shm tmpfs";
      };
    };
  }