devshell
A preset designed to be used as part of a development environment, for example to confine AI agents, or to limit the impact of potentially malicious dependencies / supply chain attacks.
Confines any application to the current directory (at time of execution), and provides persistence within the sandbox
for a number of commonly used directories (e.g. $HOME/.cache).
Use via:
{
myPackage = pkgs.mkBwrapper {
imports = [
pkgs.bwrapperPresets.devshell
];
# your config here
};
}
Source reference:
{ lib, ... }:
let
inherit (lib) mkDefault;
in
{
config = {
fhsenv.opts = {
unshareNet = mkDefault false;
};
mounts = {
readWrite = [
"$PWD"
];
sandbox = [
{
name = "config";
path = "$HOME/.config";
}
{
name = "local";
path = "$HOME/.local";
}
{
name = "cache";
path = "$HOME/.cache";
}
];
};
};
meta = {
name = "devshell";
description = ''
A preset designed to be used as part of a development environment, for example to confine AI agents, or to limit the
impact of potentially malicious dependencies / supply chain attacks.
Confines any application to the current directory (at time of execution), and provides persistence within the sandbox
for a number of commonly used directories (e.g. `$HOME/.cache`).
'';
};
}