Skip to content

Commit

Permalink
chore: add basic nix-shell stuff (#103)
Browse files Browse the repository at this point in the history
This basically just makes sure you have QEMU and rustup.

It would be nice to also get it to install all the required
cargo install tools automagically, but I'll mess with that later.

Just installing rustup should ensure that the required rustup
components are present, since they're specified in the toolchain
file. Maybe there is also a more nix-y way to do that part, but
I dgaf.
  • Loading branch information
hawkw authored Jun 5, 2021
1 parent 2c2c196 commit e36a9c5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix;
32 changes: 32 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
scope@{ pkgs ? import <nixpkgs> { } }:

pkgs.buildEnv {
name = "mycelium-kernel-env";
paths = with pkgs;
[
git
bash
direnv
binutils
stdenv
bashInteractive
cacert
gcc
cmake
rustup
pkg-config
openssl
(glibcLocales.override { locales = [ "en_US.UTF-8" ]; })
] ++ lib.optional stdenv.isDarwin [ Security libiconv ];
passthru = with pkgs; {
LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
LC_ALL = "en_US.UTF-8";
OPENSSL_DIR = "${openssl.dev}";
OPENSSL_LIB_DIR = "${openssl.out}/lib";
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
CURL_CA_BUNDLE = "${cacert}/etc/ca-bundle.crt";
CARGO_TERM_COLOR = "always";
RUST_BACKTRACE = "full";
};
}
19 changes: 19 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
scope@{ pkgs ? import <nixpkgs> { } }:

let env = (import ./default.nix scope);

in pkgs.mkShell {
# also install qemu into the dev shell, for testing
packages = [ pkgs.qemu_full ];

LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
LC_ALL = "en_US.UTF-8";
OPENSSL_DIR = "${pkgs.openssl.dev}";
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
CURL_CA_BUNDLE = "${pkgs.cacert}/etc/ca-bundle.crt";
CARGO_TERM_COLOR = "always";
RUST_BACKTRACE = "1";
buildInputs = [ (import ./default.nix { inherit pkgs; }) ];
}

0 comments on commit e36a9c5

Please sign in to comment.