summary refs log tree commit diff
path: root/lib/systems/default.nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-06-04 11:10:03 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2019-06-04 11:17:25 -0400
commit635b7625690d9f8f61da0a187e7ed4a7ec274fdc (patch)
tree80c1dc0918f028b38aa23b3abdae327fc24550dc /lib/systems/default.nix
parent40271ae1382b14673b7b3f9edb6c1f9bba1bbe47 (diff)
downloadnixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.tar
nixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.tar.gz
nixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.tar.bz2
nixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.tar.lz
nixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.tar.xz
nixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.tar.zst
nixpkgs-635b7625690d9f8f61da0a187e7ed4a7ec274fdc.zip
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 'lib/systems/default.nix')
-rw-r--r--lib/systems/default.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index ea18904cc63..8aa413f5381 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -14,7 +14,9 @@ rec {
   # `parsed` is inferred from args, both because there are two options with one
   # clearly prefered, and to prevent cycles. A simpler fixed point where the RHS
   # always just used `final.*` would fail on both counts.
-  elaborate = args: let
+  elaborate = args': let
+    args = if lib.isString args' then { system = args'; }
+           else args';
     final = {
       # Prefer to parse `config` as it is strictly more informative.
       parsed = parse.mkSystemFromString (if args ? config then args.config else args.system);