diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2019-06-04 11:10:03 -0400 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2019-06-04 11:17:25 -0400 |
commit | 635b7625690d9f8f61da0a187e7ed4a7ec274fdc (patch) | |
tree | 80c1dc0918f028b38aa23b3abdae327fc24550dc /pkgs/top-level | |
parent | 40271ae1382b14673b7b3f9edb6c1f9bba1bbe47 (diff) |
systems: allow passing in string for cross/localSystem
This makes things a little bit more convenient. Just pass in like: $ nix-build ’<nixpkgs>’ -A hello --argstr localSystem x86_64-linux --argstr crossSystem aarch64-linux
Diffstat (limited to 'pkgs/top-level')
-rw-r--r-- | pkgs/top-level/default.nix | 4 | ||||
-rw-r--r-- | pkgs/top-level/impure.nix | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index b6de076a570c6..904ef8d39796d 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -57,11 +57,11 @@ in let # From a minimum of `system` or `config` (actually a target triple, *not* # nixpkgs configuration), infer the other one and platform as needed. - localSystem = lib.systems.elaborate ( + localSystem = lib.systems.elaborate (if builtins.isAttrs args.localSystem then ( # Allow setting the platform in the config file. This take precedence over # the inferred platform, but not over an explicitly passed-in one. builtins.intersectAttrs { platform = null; } config1 - // args.localSystem); + // args.localSystem) else args.localSystem); crossSystem = if crossSystem0 == null then localSystem else lib.systems.elaborate crossSystem0; diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix index da288f15d2e2b..3ba6c08a140b2 100644 --- a/pkgs/top-level/impure.nix +++ b/pkgs/top-level/impure.nix @@ -85,6 +85,7 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // { inherit config overlays crossSystem crossOverlays; # Fallback: Assume we are building packages on the current (build, in GNU # Autotools parlance) system. - localSystem = (if args ? localSystem then {} - else { system = builtins.currentSystem; }) // localSystem; + localSystem = if builtins.isString localSystem then localSystem + else (if args ? localSystem then {} + else { system = builtins.currentSystem; }) // localSystem; }) |