Arduino-cli execution failure

Hi the community,

I’m newbie with development environment with nix-shell and I create a simple shell.nix file with the content below in order to use arduino cli.

{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = with pkgs; [
    arduino-cli
  ];
}

When I run, the arduino-cli in the nx shell dev environment, I get the error below. I made some search but without success. Can someone help me to solve this issue ?

> arduino-cli
bwrap: setting up uid map: Permission denied

Thanks

Are you running a recent Ubuntu by any chance? I ran into this issue myself `bwrap` broke on Ubuntu 24.04 · Issue #632 · containers/bubblewrap · GitHub on a GitHub CI runner.

Also, I think it’s more correct to use the packages attribute instead of buildInputs for mkShell (Nixpkgs Reference Manual)

Yes, I’m running Ubuntu 24.04.1 LTS
I updated the shell.nix according to your suggestion and tried the fix recommended below but already have the latest version of apparmor. So I still have the issue.

sudo add-apt-repository ppa:apparmor-dev/apparmor-sru
sudo apt update
sudo apt install apparmor

I use a different fix/workaround myself for the GitHub runner, but I don’t think it’s very good for use on a permanent machine: arduino-nix-template/.github/workflows/compile-check-blink.yml at 15074dc9179219ae3f226a9fc86dc1235e8170fb · SFrijters/arduino-nix-template · GitHub

Unfortunately I don’t use Ubuntu/AppArmor anywhere else, so I don’t know the best way to fix it generally.