mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[General+Nix] Add x86 level support and expose this in nix system-features
This commit is contained in:
parent
7b223a9a32
commit
6c4ce14a5c
2 changed files with 19 additions and 2 deletions
16
general.nix
16
general.nix
|
|
@ -38,7 +38,12 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
arch = mkOption {
|
arch = mkOption {
|
||||||
default = "x86-64";
|
default =
|
||||||
|
if cfg.cpu.x86.level >= 2 then
|
||||||
|
"x86-64-v${toString cfg.cpu.x86.level}"
|
||||||
|
else
|
||||||
|
"x86-64"
|
||||||
|
;
|
||||||
example = "x86-64-v2";
|
example = "x86-64-v2";
|
||||||
description = "Set CPU arch used in overlays, ...";
|
description = "Set CPU arch used in overlays, ...";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
|
@ -49,6 +54,15 @@ in
|
||||||
description = "Set CPU tuning for compilers";
|
description = "Set CPU tuning for compilers";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
x86 = {
|
||||||
|
level = mkOption {
|
||||||
|
default = 1;
|
||||||
|
example = 3;
|
||||||
|
description = "Set supported x86-64 level";
|
||||||
|
type = with types; addCheck int (n: n >= 1 && n <= 4);
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
unsafeOptimizations = mkEnableOption "unsafe system tuning";
|
unsafeOptimizations = mkEnableOption "unsafe system tuning";
|
||||||
debug = mkEnableOption "debug-specific configuration";
|
debug = mkEnableOption "debug-specific configuration";
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,10 @@ in
|
||||||
nix.package = mkIf (strings.versionOlder pkgs.nix.version "2.7") pkgs.nix_2_7;
|
nix.package = mkIf (strings.versionOlder pkgs.nix.version "2.7") pkgs.nix_2_7;
|
||||||
|
|
||||||
nix.settings.system-features = [ "big-parallel" "kvm" "benchmark" ]
|
nix.settings.system-features = [ "big-parallel" "kvm" "benchmark" ]
|
||||||
++ optional ( ! isNull generalCfg.cpuArch ) "gccarch-${generalCfg.cpuArch}"
|
++ optional ( ! isNull generalCfg.cpu.arch ) "gccarch-${generalCfg.cpu.arch}"
|
||||||
|
++ optional ( generalCfg.cpu.x86.level >= 2 ) "gccarch-x86-64-v2"
|
||||||
|
++ optional ( generalCfg.cpu.x86.level >= 3 ) "gccarch-x86-64-v3"
|
||||||
|
++ optional ( generalCfg.cpu.x86.level >= 4 ) "gccarch-x86-64-v4"
|
||||||
;
|
;
|
||||||
|
|
||||||
nix.settings.builders-use-substitutes = true;
|
nix.settings.builders-use-substitutes = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue