Compare commits

4 Commits

Author SHA1 Message Date
a7763a3b35 Update deps 2024-07-13 19:17:45 +01:00
5f15f42ffb Bump dependencies 2023-06-23 15:33:10 +02:00
b48c4d423b Add runtime dependencies to flake 2023-06-23 15:31:08 +02:00
8ecfa79ccd Remove logging 2023-06-23 15:19:26 +02:00
4 changed files with 454 additions and 6 deletions

6
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1652368125, "lastModified": 1720893482,
"narHash": "sha256-AaNNYTSxN+f85oBN2tnz8SNWiTmFo35jddTHXQjNDgM=", "narHash": "sha256-fGQczQ3JuvqSK3rYsJvvbE7j8BENLp8DqJH1B0uXYKg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f73cc9cbd82a7a8ce626bbaf02a55c1cfb34d6e5", "rev": "94c843e8f05bac70e905c48c965ba7be79bde613",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -6,9 +6,15 @@
outputs = { self, nixpkgs }: { outputs = { self, nixpkgs }: {
packages.x86_64-linux.default = packages.x86_64-linux.default =
with import nixpkgs { system = "x86_64-linux"; }; with import nixpkgs { system = "x86_64-linux"; };
nimPackages.buildNimPackage { buildNimPackage {
name = "bwbox"; name = "bwbox";
src = self; src = self;
nativeBuildInputs = [pkgs.makeWrapper];
postInstall = ''
wrapProgram $out/bin/bwbox \
--prefix PATH ':' ${pkgs.bubblewrap}/bin \
--prefix PATH ':' ${pkgs.xdg-dbus-proxy}/bin
'';
}; };
}; };
} }

View File

@@ -1,4 +1,5 @@
import strutils import strutils
import sequtils
import options import options
import config import config
import utils import utils
@@ -36,6 +37,7 @@ proc sandboxExec*(args: Args) =
config.extendConfig() config.extendConfig()
call call
.addArg("--new-session")
.addArg("--dev", "/dev") .addArg("--dev", "/dev")
.addMount("--dev-bind", "/dev/random") .addMount("--dev-bind", "/dev/random")
.addMount("--dev-bind", "/dev/urandom") .addMount("--dev-bind", "/dev/urandom")
@@ -71,10 +73,9 @@ proc sandboxExec*(args: Args) =
# resolve binary path outside of the sandbox # resolve binary path outside of the sandbox
var cmd = args.getCmd var cmd = args.getCmd
echo cmd
cmd[0] = findExe(cmd[0]) cmd[0] = findExe(cmd[0])
echo call.args.join(" ")
echo cmd echo cmd
call.addArg(cmd).exec() call.addArg(cmd).exec()

441
log Normal file

File diff suppressed because one or more lines are too long