about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorvolth <volth@volth.com>2019-04-21 17:06:50 +0000
committervolth <volth@volth.com>2019-04-30 14:28:04 +0000
commit5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e (patch)
treec5281c8a57f6f15b97113ad8709be7c96ac7f045 /nixos/modules
parentf454785bb4f2259caacec3a5806c94faed7ea301 (diff)
downloadnixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.tar
nixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.tar.gz
nixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.tar.bz2
nixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.tar.lz
nixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.tar.xz
nixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.tar.zst
nixlib-5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e.zip
compilation for particular x86_64 architecture
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 665215822af8..62421a648e16 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -60,6 +60,7 @@ let
         ${optionalString (isNix20 && !cfg.distributedBuilds) ''
           builders =
         ''}
+        system-features = ${toString cfg.systemFeatures}
         $extraOptions
         END
       '' + optionalString cfg.checkConfig (
@@ -360,6 +361,15 @@ in
         '';
       };
 
+      systemFeatures = mkOption {
+        type = types.listOf types.str;
+        default = [ ];
+        example = [ "kvm" "big-parallel" "gccarch-skylake" ];
+        description = ''
+          The supported features of a machine
+        '';
+      };
+
       checkConfig = mkOption {
         type = types.bool;
         default = true;
@@ -478,6 +488,21 @@ in
           /nix/var/nix/gcroots/tmp
       '';
 
+    nix.systemFeatures = mkIf (pkgs.stdenv.isx86_64 && pkgs.hostPlatform.platform ? gcc.arch) (
+       # can build for arch
+      mkDefault (
+        [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++
+        { # can also run code for the following achritectures:
+          "sandybridge"    = [ "gccarch-westmere" ];
+          "ivybridge"      = [ "gccarch-westmere" "gccarch-sandybridge" ];
+          "haswell"        = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" ];
+          "broadwell"      = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" ];
+          "skylake"        = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" "gccarch-broadwell" ];
+          "skylake-avx512" = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" "gccarch-broadwell" "gccarch-skylake" ];
+        }.${pkgs.hostPlatform.platform.gcc.arch}
+      )
+    );
+
   };
 
 }