2024-09-06 17:43:30 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
inputs,
|
2024-09-10 10:46:16 +02:00
|
|
|
namespace,
|
2024-09-06 17:43:30 +02:00
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: with lib; with lib.${namespace};
|
|
|
|
let
|
|
|
|
cfg = config.${namespace}.common.nix;
|
|
|
|
in {
|
2024-09-10 10:46:16 +02:00
|
|
|
options.${namespace}.common.nix = {
|
|
|
|
enable = mkEnableOption "Overwrite the default Nix configuration.";
|
|
|
|
use-lix = mkEnableOption "Enable Lix as an alternative to CppNix.";
|
|
|
|
};
|
2024-09-06 17:43:30 +02:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
nix = {
|
|
|
|
settings = {
|
|
|
|
auto-optimise-store = true;
|
|
|
|
builders-use-substitutes = true;
|
|
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
keep-derivations = true;
|
|
|
|
keep-outputs = true;
|
|
|
|
max-jobs = "auto";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Garbage collection configuration.
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
|
|
|
dates = "daily";
|
|
|
|
options = "--delete-older-than 3d";
|
|
|
|
};
|
2024-09-10 10:46:16 +02:00
|
|
|
|
|
|
|
package = mkIf cfg.use-lix pkgs.lix; # Enable LIX
|
2024-09-06 17:43:30 +02:00
|
|
|
};
|
2024-09-06 17:53:13 +02:00
|
|
|
};
|
2024-09-06 17:43:30 +02:00
|
|
|
}
|