59 lines
1.5 KiB
Nix
59 lines
1.5 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
fenix = {
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
url = "github:nix-community/fenix";
|
|
};
|
|
naersk = {
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
url = "github:nix-community/naersk";
|
|
};
|
|
};
|
|
outputs = {
|
|
fenix,
|
|
naersk,
|
|
nixpkgs,
|
|
...
|
|
}: let
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
toolchain = fenix.packages.x86_64-linux.fromToolchainFile {
|
|
file = ./rust-toolchain.toml;
|
|
sha256 = "sha256-zC8E38iDVJ1oPIzCqTk/Ujo9+9kx9dXq7wAwPMpkpg0=";
|
|
};
|
|
in {
|
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.espflash
|
|
pkgs.esp-generate
|
|
pkgs.rust-analyzer
|
|
toolchain
|
|
];
|
|
shellHook = ''
|
|
export RUSTUP_TOOLCHAIN=${toolchain}
|
|
'';
|
|
};
|
|
packages.x86_64-linux.default =
|
|
(naersk.lib.x86_64-linux.override {
|
|
cargo = toolchain;
|
|
rustc = toolchain;
|
|
}).buildPackage {
|
|
src = ./.;
|
|
|
|
# set these to build the project
|
|
ACCESS_POINT_SSID = null;
|
|
ACCESS_POINT_PASS = null;
|
|
|
|
# UPDATE .cargo/config.toml to reflect changes here in the runner
|
|
postInstall = ''
|
|
mv $out/bin/esp32c6-play $out/bin/.esp32c6-play
|
|
cat<<EOF>$out/bin/esp32c6-play
|
|
#!/usr/bin/bash
|
|
${pkgs.lib.getExe pkgs.espflash} flash --monitor --chip esp32c6 $(echo $out)/bin/.esp32c6-play
|
|
EOF
|
|
chmod +x $out/bin/esp32c6-play
|
|
'';
|
|
};
|
|
};
|
|
}
|