{ lib, config, ... }: { options.my.nix = { features = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-znver3" "gccarch-skylake" "gccarch-alderlake" ]; description = "List of supported nix build features for this system"; }; buildMachines = lib.mkOption { type = lib.types.listOf lib.types.attrs; default = [ ]; description = "List of remote build machines configuration"; }; cores = lib.mkOption { type = lib.types.nullOr lib.types.int; default = null; description = "Number of cores to use for builds (null = auto-detect)"; }; maxJobs = lib.mkOption { type = lib.types.nullOr lib.types.int; default = null; description = "Maximum number of parallel jobs (null = auto-detect)"; }; }; config = { nix.settings = lib.mkMerge [ { system-features = config.my.nix.features; } (lib.mkIf (config.my.nix.cores != null) { inherit (config.my.nix) cores; }) (lib.mkIf (config.my.nix.maxJobs != null) { max-jobs = config.my.nix.maxJobs; }) ]; nix.buildMachines = lib.mkIf (config.my.nix.buildMachines != [ ]) config.my.nix.buildMachines; }; }