Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-x86_64 systems #7

Open
thoughtpolice opened this issue Dec 22, 2017 · 1 comment
Open

Support non-x86_64 systems #7

thoughtpolice opened this issue Dec 22, 2017 · 1 comment

Comments

@thoughtpolice
Copy link

thoughtpolice commented Dec 22, 2017

For work, we have some non-conventional build targets including ARMv7 (and soon AArch64), as well as bog-standard i686-linux that we deploy NixOS and Nix closures onto. (I also personally have a nice AArch64 device that could run Nix well.) We just got done doing a big deployment to them, and something like this would have been a nice alternative over nix-copy-closure.

However, the parser implicitly models the operating system (maybe better to say Platform, to follow meta.platform in mkDerivation) as an ADT with only X86_64_Linux and X86_64_Darwin targets.

I think this should be extended at the very least, but here's another hair-brained suggestion: just make it a free form string, and warn on an "unusual" platform target?

For example, you could take a lesson from arcanist from Phabricator, where if an 'unusual' build target does not match a list of known ones, you simply suggest it was mistyped. For extra bonus points, you could also calculate the levenshtein distance to the list of known platforms and assume a typo at some threshold. Assuming a theoretical new --platform flag, maybe something like:

$ nix-delegate --platform x86_64-linux ... # works normally
...

$ nix-delegate --platform armv7l-linux ... # works normally
...

$ nix-delegate --platform ppc64le-linux ... # unknown target?
WARNING: platform 'ppc64le-linux' seems unusual (I have not heard of it), but proceeding anyway...
...

$ nix-delegate --platform aaarch64-linux ... # oops, typo
WARNING: platform 'aaarch64-linux' seems unusual; maybe you meant 'aarch64-linux'? Proceeding anyway...

A default list of built-in recognized platforms might look like:

platforms =
  [ "i686-linux"
  , "x86_64-linux"
  , "x86_64-darwin"
  , "armv7l-linux" -- maybe some extras, like 'armv6hf-linux' for raspbian/raspberry pi?
  , "aarch64-linux"
  ]
@thoughtpolice
Copy link
Author

I would also of course make nix-delegate output any warnings in LARGE, BOLD letters with an ANSI color code on the platform names, to make it pretty and so the user doesn't miss it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant