From 5ad79dc4bb22326e5a98db7bf2b69a76a2e6f01e Mon Sep 17 00:00:00 2001 From: volth Date: Sun, 21 Apr 2019 17:06:50 +0000 Subject: compilation for particular x86_64 architecture --- nixos/modules/services/misc/nix-daemon.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'nixos/modules') 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} + ) + ); + }; } -- cgit 1.4.1 From 5a2356cff1816f8e05024f3e943f185a1288db19 Mon Sep 17 00:00:00 2001 From: volth Date: Tue, 30 Apr 2019 16:28:21 +0000 Subject: nix.systemFeatures: minor refactor --- nixos/modules/services/misc/nix-daemon.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'nixos/modules') diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 62421a648e16..fe68879fda9d 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -363,7 +363,6 @@ in systemFeatures = mkOption { type = types.listOf types.str; - default = [ ]; example = [ "kvm" "big-parallel" "gccarch-skylake" ]; description = '' The supported features of a machine @@ -488,11 +487,11 @@ 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: + nix.systemFeatures = mkDefault ( + [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ + optionals (pkgs.stdenv.isx86_64 && pkgs.hostPlatform.platform ? gcc.arch) ( + # a x86_64 builder can run code for `platform.gcc.arch` and minor architectures: + [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ { "sandybridge" = [ "gccarch-westmere" ]; "ivybridge" = [ "gccarch-westmere" "gccarch-sandybridge" ]; "haswell" = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" ]; -- cgit 1.4.1