Storage¶
Source directory: modules/storage/
default.nix¶
No option declarations; see source for implementation.
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, schedule, keepGenerations, keepDays, deleteOlderThan, optimizeStore, minFreeSpace, aggressiveCleanup
Options declaration (Nix)
options.storage.garbageCollection = {
enable = mkEnableOption "Enable automatic Nix garbage collection";
schedule = mkOption {
type = types.enum [ "daily" "weekly" "monthly" ];
default = "weekly";
description = "Frequency of garbage collection";
};
keepGenerations = mkOption {
type = types.int;
default = 5;
description = "Number of system generations to keep";
};
keepDays = mkOption {
type = types.int;
default = 30;
description = "Delete store paths older than this many days";
};
deleteOlderThan = mkOption {
type = types.str;
default = "30d";
description = "Age threshold for deletion (e.g., 30d, 14d, 7d)";
example = "30d";
};
optimizeStore = mkOption {
type = types.bool;
default = true;
description = "Optimize Nix store after garbage collection (deduplication)";
};
minFreeSpace = mkOption {
type = types.nullOr types.int;
default = 10;
description = "Minimum free space in GB to maintain (null to disable)";
};
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 I/O scheduler optimization
- Enable option: Enable filesystem optimization
- Enable option: Enable NVMe-specific optimizations
- Enable option: Enable disk cache optimization
- Enable option: Enable tmpfs optimization for performance
Options: enable, profile, dynamicScheduling, ssdOptimization, hddOptimization, readaheadOptimization, cacheOptimization, compressionOptimization, queueDepth, polling, multiQueue, writeCache, readCache, barrierOptimization, 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";
};
ioSchedulerOptimization = {
enable = mkEnableOption "Enable I/O scheduler optimization";
dynamicScheduling = mkOption {
type = types.bool;
default = true;
description = "Enable dynamic I/O scheduler selection based on workload";
};
ssdOptimization = mkOption {
type = types.bool;
default = true;
description = "Enable SSD-specific optimizations";
};
hddOptimization = mkOption {
type = types.bool;
default = true;
description = "Enable HDD-specific optimizations";
};
};
filesystemOptimization = {
enable = mkEnableOption "Enable filesystem optimization";
readaheadOptimization = mkOption {
type = types.bool;
default = true;
description = "Enable readahead optimization";
};
cacheOptimization = mkOption {
type = types.bool;
default = true;
description = "Enable filesystem cache optimization";
};
compressionOptimization = mkOption {
type = types.bool;
default = false;
description = "Enable filesystem compression optimization";
};
};
nvmeOptimization = {
enable = mkEnableOption "Enable NVMe-specific optimizations";
queueDepth = mkOption {
type = types.int;
default = 32;
description = "NVMe queue depth optimization";
};
polling = mkOption {
type = types.bool;
default = true;
description = "Enable NVMe polling for low latency";
};
multiQueue = mkOption {
type = types.bool;
default = true;
description = "Enable NVMe multi-queue support";
};
};
diskCacheOptimization = {
enable = mkEnableOption "Enable disk cache optimization";
writeCache = mkOption {
type = types.bool;
default = true;
description = "Enable write cache optimization";
};
readCache = mkOption {
type = types.bool;
default = true;
description = "Enable read cache optimization";
};
# … truncated — see source link above