Skip to content

Commit 248be89

Browse files
authored
chore: add Nix dev shell (#218)
1 parent e1cce16 commit 248be89

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix;

default.nix

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
scope@{ pkgs ? import <nixpkgs> { } }:
2+
3+
let locale = "en_US.UTF8";
4+
in with pkgs;
5+
buildEnv {
6+
name = "mnemos-env";
7+
paths = with pkgs;
8+
[
9+
git
10+
bash
11+
direnv
12+
binutils
13+
stdenv
14+
bashInteractive
15+
docker
16+
cacert
17+
gcc
18+
openssl
19+
shellcheck
20+
(glibcLocales.override { locales = [ locale ]; })
21+
] ++ lib.optional stdenv.isDarwin [ Security libiconv ];
22+
23+
nativeBuildInputs = [ pkg-config cmake rustup ];
24+
buildInputs = [
25+
clang
26+
libclang
27+
systemd
28+
udev
29+
SDL2
30+
SDL2.dev
31+
# other stuff
32+
bash
33+
];
34+
passthru = with pkgs; {
35+
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
36+
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
37+
CURL_CA_BUNDLE = "${cacert}/etc/ca-bundle.crt";
38+
39+
CARGO_TERM_COLOR = "always";
40+
RUST_BACKTRACE = "true";
41+
42+
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
43+
44+
OPENSSL_DIR = "${openssl.dev}";
45+
OPENSSL_LIB_DIR = "${openssl.out}/lib";
46+
47+
LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
48+
49+
};
50+
}

shell.nix

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
scope@{ pkgs ? import <nixpkgs> { } }:
2+
with pkgs;
3+
let
4+
mnemos = import ./default.nix { inherit pkgs; };
5+
6+
env = buildEnv {
7+
name = "mnemos-env";
8+
paths = [ ] ++ lib.optional stdenv.isDarwin libiconv ++ mnemos.buildInputs
9+
++ mnemos.nativeBuildInputs;
10+
};
11+
in mkShell {
12+
nativeBuildInputs = [ pkg-config ];
13+
buildInputs = [
14+
clang
15+
libclang
16+
systemd
17+
udev
18+
# for melpomene
19+
SDL2
20+
SDL2.dev
21+
];
22+
packages = [
23+
# devtools
24+
just
25+
cargo-nextest
26+
direnv
27+
# rust esp32 tools
28+
cargo-espflash
29+
cargo-espmonitor
30+
# for testing the x86_64 kernel
31+
qemu
32+
];
33+
34+
PROTOC = "${protobuf}/bin/protoc";
35+
PROTOC_INCLUDE = "${protobuf}/include";
36+
37+
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
38+
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
39+
CURL_CA_BUNDLE = "${cacert}/etc/ca-bundle.crt";
40+
CARGO_TERM_COLOR = "always";
41+
42+
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
43+
44+
OPENSSL_DIR = "${openssl.dev}";
45+
OPENSSL_LIB_DIR = "${openssl.out}/lib";
46+
}

0 commit comments

Comments
 (0)