base configuration

This commit is contained in:
Dennis Wuitz
2023-12-23 06:49:01 +01:00
commit 75405396d2
33 changed files with 2420 additions and 0 deletions

27
modules/simd.nix Normal file
View File

@ -0,0 +1,27 @@
{ config, lib, libS, ... }:
let
cfg = config.simd;
in
{
options.simd = {
enable = lib.mkEnableOption "optimized builds with simd instructions";
arch = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
description = ''
Microarchitecture string for nixpkgs.hostPlatform.gcc.march and to generate system-features.
Can be determined with: ``nix shell nixpkgs#gcc -c gcc -march=native -Q --help=target | grep march``
'';
};
};
config = {
nix.settings.system-features = lib.mkIf (cfg.arch != null) (libS.nix.gcc-system-features config.simd.arch);
nixpkgs.hostPlatform = lib.mkIf cfg.enable {
gcc.arch = config.simd.arch;
inherit (config.nixpkgs) system;
};
};
}