Use of "environment:" for class confinement snap

While working on classic confinement snap I was exploring setting various ENV vars (basically to cajol the snap’s commands to use bundled python as opposed to the host systems python). I had success with a wrapper script but I saw references to using “environment:” in snapcraft.yam here

And there is a more specific thread here

and indeed doing something like

PATH: $SNAP/usr/bin/:$PATH

solves my problem without managing a custom wrapper script (which is nice). I am a bit worried as i cannot find a reference to “environment:” looking here Is “environment:” legit, worried it might be deprecated or not fully supported. So asking is using environment: block in a snapcraft.yaml a robust solution?



We’re missing documentation for environments, indeed! Thank you for the heads up. However, yes, it is a fully-supported feature, and I am not aware of it being deprecated. Feel free to use it!

1 Like