Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ only combination that gets autofocus.

## Prerequisites

NOTE: `nix develop` now provides ESP-IDF `v6.1`, its toolchain, Python tools, and the host tools. This means that `nix` users don't need to follow the following instructions and can skip [here](#developing-on-nix), and then follow [build instructions](#build).

Kern targets [ESP-IDF v6.1](https://docs.espressif.com/projects/esp-idf/en/v6.1/esp32p4/get-started/index.html). Install it for the `esp32p4` target:

```bash
Expand All @@ -49,14 +51,14 @@ git clone --depth 1 --recurse-submodules --shallow-submodules -b v6.1 https://gi
. ~/esp/esp-idf/export.sh
```

For formatting, host tests, and the desktop simulator, Nix users can enter the development shell:
### Developing on nix

Nix users can enter the development shell:

```bash
nix develop
```

The Nix shell intentionally provides host tools only. Firmware builds still require the separate ESP-IDF v6.1 installation above; `just build` uses an existing `IDF_PATH` or falls back to `~/esp/esp-idf`.

## Build

### Cloning the Repository
Expand Down
58 changes: 57 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 34 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
# mirrexagon/nixpkgs-esp-dev#135 (ESP-IDF v6.1) plus a libpython3.14 fix for Linux.
nixpkgs-esp-dev = {
url = "github:Sammyalhashe/nixpkgs-esp-dev/b574e8e501dfa691814c87d4151043eb991d2be9";

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there an official source for ESP-IDF?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but until mirrexagon/nixpkgs-esp-dev#135 is merged and libpython3.14 is added as in Sammyalhashe/nixpkgs-esp-dev@b574e8e then we need this.

Once this is added I can revert back.

inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs }:
outputs =
{
self,
nixpkgs,
nixpkgs-esp-dev,
}:
let
systems = [
"x86_64-linux"
Expand All @@ -17,9 +27,20 @@
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
devShells = forAllSystems (system:
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
pkgs = import nixpkgs {
inherit system;
overlays = [ nixpkgs-esp-dev.overlays.default ];

# The Python library ecdsa is marked as insecure, but we need it for esptool.
# See https://github.com/mirrexagon/nixpkgs-esp-dev/issues/109
config.permittedInsecurePackages = [
"python3.13-ecdsa-0.19.1"
"python3.13-ecdsa-0.19.2"
];
};

# LLVM 21 is the major ESP-IDF 6.1 ships as esp-clang and the one
# scripts/format.sh requires: clang-format's defaults drift between
Expand All @@ -35,6 +56,10 @@
default = mkShell {
name = "kern-dev-shell";

# The host tests build with -Werror, and fortify adds glibc's
# warn_unused_result to calls like posix_memalign that CI never sees.
hardeningDisable = [ "fortify" ];

buildInputs = [
# clang-format, clang-tidy and clangd, for scripts/format.sh
# and the checked-in .clang-tidy / .clangd configs.
Expand All @@ -50,6 +75,8 @@
pkgs.mbedtls
pkgs.SDL2
pkgs.pkg-config
# ESP-IDF v6.1 with its toolchains and Python env (incl. esp-idf-sbom).
pkgs.esp-idf-full
];

shellHook = ''
Expand All @@ -59,9 +86,10 @@
echo " cmake: $(cmake --version | head -1)"
echo " make: $(make --version | head -1)"
echo " just: $(just --version)"
echo " firmware: install ESP-IDF v6.1 separately"
echo " firmware: ESP-IDF $(cat "$IDF_PATH/version.txt")"
'';
};
});
}
);
};
}
}
2 changes: 1 addition & 1 deletion scripts/ci-checks.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Run all CI checks for a single commit: format, tests, and a wave_4b build.
# Invoked from the per-commit CI loop (see .github/workflows/test-each-commit.yml)
Expand Down
2 changes: 1 addition & 1 deletion scripts/format.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Script to run clang-format on all .c and .h files in project source directories
# Covers main/ and first-party components (excludes libwally-core)
Expand Down
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Expand Down
2 changes: 1 addition & 1 deletion scripts/sign_release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Kern release signing + packaging — runs on the AIR-GAPPED signing PC.
#
# For each device staged by release.sh, this script:
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Run all project tests

Expand Down