-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
64 lines (56 loc) · 2.18 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
description = "ESP-32 Rust dev environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShells.default = pkgs.mkShell {
# packages to install
buildInputs = with pkgs; [
bashInteractive # fixes console in vscode
cargo-generate # generate rust projects from github templates
cargo-udeps # find unused dependencies in Cargo.toml
# required for esp development
espup # tool for installing esp-rs toolchain
rustup # rust installer, required by espup
espflash # flash binary to esp
python3
];
# execute some commands before environment is accessible
shellHook = ''
echo -e "\e[1mInstalling toolchains for esp"
echo -e "-----------------------------\e[0m"
espup install
. ~/export-esp.sh
echo
echo -e "\e[1mInstalling ldproxy"
echo -e "------------------\e[0m"
cargo install ldproxy
'';
# https://github.com/Mic92/nix-ld
NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc
pkgs.libxml2
];
NIX_LD = (pkgs.runCommand "ld.so" {} ''
ln -s "$(cat '${pkgs.stdenv.cc}/nix-support/dynamic-linker')" $out
'');
};
}
);
# use prebuilt binaries
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
}