mirrexagon / nixpkgs-esp-dev

Nix flake and overlay for ESP8266 and ESP32 development.
Creative Commons Zero v1.0 Universal
132 stars 61 forks source link

Update to esp-idf 5.2.2 #56

Closed cortex closed 1 month ago

anpin commented 3 months ago

Hi, I have just tried your PR and found that idf.py --version still reports to be at 5.1.3

idf.py --version
fatal: not a git repository: '/nix/store/6fhgra3f7pmzljs1gz20ysv8ixq33il1-esp-idf-v5.2.2/.git'
WARNING: Git version unavailable, reading from source
ESP-IDF v5.1.3
nagy commented 3 months ago

btw, there is another similar PR to this one #47

cortex commented 3 months ago

btw, there is another similar PR to this one #47

Thanks for pointing this out! I merged the changes into this branch, though I didn't bump in to these problems.

cortex commented 3 months ago

Hi, I have just tried your PR and found that idf.py --version still reports to be at 5.1.3


idf.py --version
fatal: not a git repository: '/nix/store/6fhgra3f7pmzljs1gz20ysv8ixq33il1-esp-idf-v5.2.2/.git'
WARNING: Git version unavailable, reading from source
ESP-IDF v5.1.3
`

@anpin Does it work for you with the latest changes?

nagy commented 3 months ago

though I didn't bump in to these problems.

I did, that's how I found that PR. You can try to run this to see if your branch is able to build basic examples:

nix-build -E "with import <nixpkgs> {overlays=[(import ./overlay.nix)];}; callPackage ./tests/build-idf-examples.nix {}"
cortex commented 3 months ago

though I didn't bump in to these problems.

I did, that's how I found that PR. You can try to run this to see if your branch is able to build basic examples:

nix-build -E "with import <nixpkgs> {overlays=[(import ./overlay.nix)];}; callPackage ./tests/build-idf-examples.nix {}"

Thank you! With my latest change this build successfully for me at least

nagy commented 3 months ago

One more thing I noticed is that, in that example file, there is still:

  buildsNameList = pkgs.lib.attrsets.cartesianProductOfSets {
    target = [ "esp32" "esp32c3" "esp32s2" "esp32s3" "esp32c6" "esp32h2" ];
    example = [ "get-started/hello_world" ];
  };

https://github.com/Lindboard/nixpkgs-esp-dev/blob/master/tests/build-idf-examples.nix#L36-L39

With idf 5.2 it looks like we are consolidating the esps2 and esps3 into the esp compiler. So maybe those two extra entries are no longer needed anymore in that test, but I am not sure.

mksafavi commented 2 months ago

Hi. Is there anything blocking this?

mirrexagon commented 2 months ago

Probably just me having time to review what's been done and merge this - I'll try to do that in the next day or two.

saippua commented 2 months ago

112c9d10b9e171bacf68b91ee63606ab6f9a4529 what is the purpose of the version.txt file? The commit description makes me think its related to the issue that idf.py cannot find the version from git, because the nix store's git repository doesn't retain any tags. But I don't see how the version.txt file would help (and alas, I'm still getting that pesky warning from idf.py)

Honestly I haven't figured out how to get rid of the warning. Something like your earlier commit where you init a git repo inside the store directory, then manually adding the tag there could work, however it doesn't seem like a very stable solution.

On the other hand, maybe the problem is on the esp-idf side. Why should it throw unnecessary stderr warnings when it can't find the version through git tags, when it just falls back to getting the version from cmake, which should probably be the default anyway?

In any case, I've read elsewhere that leaveDotGit should be avoided as the .git folder is not stable. Not sure if that's true but here's the thread: https://discourse.nixos.org/t/keep-git-folder-in-when-fetching-a-git-repo/8590/7

saippua commented 2 months ago

I would also recommend something like this: 0298b4e616b4bbb32a8175fac8c38599e2ea59e3

esp-idf checks that the python executable matches the IDF_PYTHON_ENV_PATH variable, which it won't if you set the env var to the symbolic link instead of the actual executable path. see: https://sourcegraph.com/github.com/espressif/esp-idf/-/blob/tools/idf.py?L110-114

saippua commented 1 month ago

Regarding the leaveDotGit option, I can now confirm that I've experienced some issues when it's set to true. I was trying to build the derivation on a different system but kept getting error: hash mismatch in fixed-output derivation, and the received hash kept changing every time.

Here's the relevant nixpkgs issue. https://github.com/NixOS/nixpkgs/issues/8567

mirrexagon commented 1 month ago

I also have noticed that leaveDotGit makes the output of fetchGit unstable, and yeah, in this case trying to build this branch causes a hash mismatch. @cortex For now, can we undo the leaveDotGit and the version.txt changes? Is that a problem for anyone? In my experience, the warning can just be ignored and everything works well enough.

I've been mostly ignoring trying to deal with the version stuff (#5) since I don't know enough about how the IDF checks versions and it doesn't cause me problems to have the warning.

cortex commented 1 month ago

Great, thanks for removing the git hacking and getting this merged! I'll take a look at the version stuff separately.