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
This commit is contained in:
Matthew Bauer
2019-06-04 11:17:25 -04:00
parent 40271ae138
commit 635b762569
3 changed files with 8 additions and 5 deletions
+3 -2
View File
@@ -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;
})