summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix39
1 files changed, 30 insertions, 9 deletions
diff --git a/flake.nix b/flake.nix
index 08806f4..9d42c39 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,32 +1,53 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
- rust-overlay = {
+ fenix = {
inputs.nixpkgs.follows = "nixpkgs";
- url = "github:oxalica/rust-overlay";
+ url = "github:nix-community/fenix";
+ };
+ naersk = {
+ inputs.nixpkgs.follows = "nixpkgs";
+ url = "github:nix-community/naersk";
};
};
outputs = {
+ fenix,
+ naersk,
nixpkgs,
- rust-overlay,
...
}: let
- pkgs = import nixpkgs {
- system = "x86_64-linux";
- overlays = [(import rust-overlay)];
+ pkgs = nixpkgs.legacyPackages.x86_64-linux;
+ toolchain = fenix.packages.x86_64-linux.fromToolchainFile {
+ file = ./rust-toolchain.toml;
+ sha256 = "sha256-zC8E38iDVJ1oPIzCqTk/Ujo9+9kx9dXq7wAwPMpkpg0=";
};
- rust-bin = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in {
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [
pkgs.espflash
pkgs.esp-generate
pkgs.rust-analyzer
- rust-bin
+ toolchain
];
shellHook = ''
- export RUSTUP_TOOLCHAIN=${rust-bin}
+ export RUSTUP_TOOLCHAIN=${toolchain}
'';
};
+ packages.x86_64-linux.default =
+ (naersk.lib.x86_64-linux.override {
+ cargo = toolchain;
+ rustc = toolchain;
+ }).buildPackage {
+ src = ./.;
+ # 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
+ '';
+ };
};
}