mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
Massive refactoring in configurable modules
This commit is contained in:
commit
4319f5a3cc
14 changed files with 603 additions and 0 deletions
92
general.nix
Normal file
92
general.nix
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.aviallon.general;
|
||||
in
|
||||
{
|
||||
options.aviallon.general = {
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
description = "Enable aviallon's general tuning";
|
||||
type = types.bool;
|
||||
};
|
||||
cpuArch = mkOption {
|
||||
default = "x86-64";
|
||||
example = "x86-64-v2";
|
||||
description = "Set CPU arch used in overlays, ...";
|
||||
type = types.str;
|
||||
};
|
||||
cpuTune = mkOption {
|
||||
default = "generic";
|
||||
example = "sandybridge";
|
||||
description = "Set CPU tuning for compilers";
|
||||
type = types.str;
|
||||
};
|
||||
unsafeOptimizations = mkEnableOption "unsafe system tuning";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Paris";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n = {
|
||||
defaultLocale = "fr_FR.UTF-8";
|
||||
};
|
||||
|
||||
console = {
|
||||
keyMap = "fr-pc";
|
||||
font = "Lat2-Terminus16";
|
||||
};
|
||||
|
||||
boot.kernelParams = concatLists [
|
||||
(optional cfg.unsafeOptimizations "mitigations=off")
|
||||
];
|
||||
|
||||
powerManagement.cpuFreqGovernor = mkDefault "schedutil";
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
programs.mtr.enable = true;
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
|
||||
nix.gc.automatic = mkDefault true;
|
||||
nix.gc.randomizedDelaySec = "30min";
|
||||
nix.optimise.automatic = mkDefault true;
|
||||
|
||||
nix.daemonIOSchedPriority = 5;
|
||||
nix.daemonCPUSchedPolicy = "batch";
|
||||
nix.daemonIOSchedClass = "idle";
|
||||
|
||||
system.autoUpgrade.enable = mkDefault true;
|
||||
system.autoUpgrade.allowReboot = mkOverride 500 true;
|
||||
system.autoUpgrade.dates = "00:00";
|
||||
|
||||
|
||||
nixpkgs.localSystem.system = builtins.currentSystem;
|
||||
nixpkgs.localSystem.platform = lib.systems.platforms.pc // {
|
||||
gcc.arch = cfg.cpuArch;
|
||||
gcc.tune = cfg.cpuTune;
|
||||
};
|
||||
|
||||
nix.buildMachines = [
|
||||
{
|
||||
hostName = "lesviallon.fr";
|
||||
system = "x86_64-linux";
|
||||
maxJobs = 2;
|
||||
speedFactor = 4;
|
||||
supportedFeatures = [ "kvm" "benchmark" "big-parallel" ];
|
||||
}
|
||||
];
|
||||
nix.distributedBuilds = mkDefault false;
|
||||
|
||||
nix.extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue