Skip to content

Commit

Permalink
chore: add Nix dev shell (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw authored Aug 7, 2023
1 parent e1cce16 commit 248be89
Show file tree
Hide file tree
Showing 3 changed files with 97 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;
50 changes: 50 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
scope@{ pkgs ? import <nixpkgs> { } }:

let locale = "en_US.UTF8";
in with pkgs;
buildEnv {
name = "mnemos-env";
paths = with pkgs;
[
git
bash
direnv
binutils
stdenv
bashInteractive
docker
cacert
gcc
openssl
shellcheck
(glibcLocales.override { locales = [ locale ]; })
] ++ lib.optional stdenv.isDarwin [ Security libiconv ];

nativeBuildInputs = [ pkg-config cmake rustup ];
buildInputs = [
clang
libclang
systemd
udev
SDL2
SDL2.dev
# other stuff
bash
];
passthru = with pkgs; {
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 = "true";

LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";

OPENSSL_DIR = "${openssl.dev}";
OPENSSL_LIB_DIR = "${openssl.out}/lib";

LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";

};
}
46 changes: 46 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
scope@{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
mnemos = import ./default.nix { inherit pkgs; };

env = buildEnv {
name = "mnemos-env";
paths = [ ] ++ lib.optional stdenv.isDarwin libiconv ++ mnemos.buildInputs
++ mnemos.nativeBuildInputs;
};
in mkShell {
nativeBuildInputs = [ pkg-config ];
buildInputs = [
clang
libclang
systemd
udev
# for melpomene
SDL2
SDL2.dev
];
packages = [
# devtools
just
cargo-nextest
direnv
# rust esp32 tools
cargo-espflash
cargo-espmonitor
# for testing the x86_64 kernel
qemu
];

PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";

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";

LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";

OPENSSL_DIR = "${openssl.dev}";
OPENSSL_LIB_DIR = "${openssl.out}/lib";
}

0 comments on commit 248be89

Please sign in to comment.