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

Add a Nix-shell script #1071

Merged
merged 1 commit into from Jul 5, 2018

Conversation

Projects
None yet
3 participants
@alevy
Copy link
Member

alevy commented Jul 4, 2018

Pull Request Overview

For Nix package manager users (or NixOS users), the new shell.nix
script plops you into an environment with all the tools necessary for
general Tock development:

  • rustup
  • gcc-arm-embedded (I think this one can go away when we switch to
    LLVM tools that ship with Rust)
  • tockloader, which is used for interacting with the dev boards

Testing Strategy

I've been using it myself on my laptop. I actually don't promise this is bug-free, but the three other NixOS users out there might find the bugs eventually.

Also, OS X users can try using Nix package manager instead of (or in addition) to brew and will no longer have to compile everything from source.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make formatall.

@alevy alevy force-pushed the alevy:nixshell branch from bd1c583 to 893a21f Jul 4, 2018

@alevy alevy added the P-Upkeep label Jul 4, 2018

@ppannuto
Copy link
Member

ppannuto left a comment

micro complaint: is there a way to do this that doesn’t add another file to the top-level directory? I have a loose preference to minimize clutter there if possible

version = "1.1.0";
name = "${pname}-${version}";

propagatedBuildInputs = [ argcomplete colorama crcmod pyserial pytoml ];

This comment has been minimized.

@ppannuto

ppannuto Jul 4, 2018

Member

Is this really just a copy of https://github.com/tock/tockloader/blob/master/setup.py#L31 ?

There's no way to pull that automatically from the package itself? :/

This comment has been minimized.

@alevy

alevy Jul 4, 2018

Member

Pretty much. I don't know nix shell well enough yet to know if there is a way to avoid doing that, but I needed it to build.

shell.nix Outdated
# #sha256 = "7c724ee47badc875885747a3e3b79b3fa0f139611a17376c9b35ac0190aa4ca6";
#});
#nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
#rustChannel= nixpkgs.rustChannelOf { channel = rustChan; date = rustVersion; };

This comment has been minimized.

@ppannuto

ppannuto Jul 4, 2018

Member

Delete all this?

This comment has been minimized.

@alevy

alevy Jul 4, 2018

Member

Oh woops, yes.

This comment has been minimized.

@alevy

alevy Jul 4, 2018

Member

Fixed

Add a Nix-shell script
For Nix package manager users (or NixOS users), the new `shell.nix`
script plops you into an environment with all the tools necessary for
general Tock development:

  * `rustup`
  * `gcc-arm-embedded` (I think this one can go away when we switch to
LLVM tools that ship with Rust)
  * `tockloader`, which is used for interacting with the dev boards

@alevy alevy force-pushed the alevy:nixshell branch from 893a21f to bc41a1c Jul 4, 2018

@alevy

This comment has been minimized.

Copy link
Member

alevy commented Jul 4, 2018

micro complaint: is there a way to do this that doesn’t add another file to the top-level directory? I have a loose preference to minimize clutter there if possible

shell.nix and default.nix are magic names that don't need to be specified, but you can pass a nix script explicitly to nix-shell. So we could place shell.nix in a subdirectory (tools/?) and users could either specify that file explicitly or copy/symlink it to the root (and we would maybe add ./shell.nix to .gitignore)

@ppannuto
Copy link
Member

ppannuto left a comment

Eh, I don't object so strongly to the root file to necessitate all that rigamarole I don't think.

@alevy alevy merged commit f05997c into tock:master Jul 5, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@alevy alevy deleted the alevy:nixshell branch Jul 5, 2018

@lschuermann

This comment has been minimized.

Copy link

lschuermann commented Jul 5, 2018

Shoot, I was going to do a PR a while ago but somehow forgot about it. Your shell.nix has basically the same contents as mine and works like a charm!

Do you think it might be a good idea to upstream tockloader into nixpkgs? Then it's also going to be built by hydra and if something breaks, we might get an email... I could create a PR with them later, in case there are no complaints.

@lschuermann

This comment has been minimized.

Copy link

lschuermann commented Jul 5, 2018

Maybe it would also be better to move away from rustup on NixOS. As far as I can tell, it is not needed apart from getting a nightly version of rust.
It is possible to pin a specific rust version, for example from the Mozilla overlay. I would be willing to look into how this can be done elegantly. This would mean even less hassle and more effective use of the Nix store! :)

@alevy

This comment has been minimized.

Copy link
Member

alevy commented Jul 5, 2018

Do you think it might be a good idea to upstream tockloader into nixpkgs

Yes, tockloader and elf2tab would both be good I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment