1 { lib, writeText, runCommand, writeClosure }:
20 options = [ "nosuid" "strictatime" "mode=755" "size=65536k" ];
25 options = [ "nosuid" "noexec" "newinstance" "ptmxmode=0666" "mode=755" "gid=5" ];
30 options = [ "nosuid" "noexec" "nodev" "mode=1777" "size=65536k" ];
35 options = [ "nosuid" "noexec" "nodev" ];
40 options = [ "nosuid" "noexec" "nodev" "ro" ];
45 options = [ "nosuid" "noexec" "nodev" "relatime" "ro" ];
48 config = writeText "config.json" (builtins.toJSON {
55 namespaces = map (type: { inherit type; }) [ "pid" "network" "mount" "ipc" "uts" ];
58 root = { path = "rootfs"; inherit readonly; };
62 user = { uid = 0; gid = 0; };
66 mounts = lib.mapAttrsToList (destination: { type, source, options ? null }: {
67 inherit destination type source options;
71 runCommand "join" {} ''
73 mkdir -p $out/rootfs/{dev,proc,sys}
74 cp ${config} $out/config.json
75 xargs tar c < ${writeClosure args} | tar -xC $out/rootfs/