This commit is contained in:
Emery Hemingway 2021-04-12 21:08:24 +02:00
parent 67fbe1ea9a
commit 519d99af30
4 changed files with 30 additions and 21 deletions

View File

@ -1,3 +1 @@
{
imports = [ ./tor.nix ];
}
{ imports = [ ./tor.nix ]; }

View File

@ -7,7 +7,7 @@ let Libc = Sigil.Libc
let VFS = Sigil.VFS
in λ(args : List Text) →
λ(lwipCap : Text) →
λ(vfs : { lwip : Text, pipe : Text }) →
λ(binary : Text) →
Init.Child.flat
Init.Child.Attributes::{
@ -17,7 +17,7 @@ in λ(args : List Text) →
Libc::{
, args
, pipe = Some "/dev/pipes"
, rtc = Some "/dev/random"
, rng = Some "/dev/entropy"
, socket = Some "/dev/sockets"
, vfs =
[ VFS.dir
@ -25,11 +25,18 @@ in λ(args : List Text) →
[ VFS.leaf "null"
, VFS.leaf "log"
, VFS.leaf "rtc"
, VFS.leafAttrs "terminal" (toMap { label = "entropy" })
, VFS.dir "pipes" [ VFS.leaf "pipe" ]
, VFS.leafAttrs
"terminal"
(toMap { name = "entropy", label = "entropy" })
, VFS.dir
"pipes"
[ VFS.leafAttrs "plugin" (toMap { load = vfs.pipe }) ]
, VFS.dir
"sockets"
[ VFS.leafAttrs "plugin" (toMap { load = lwipCap }) ]
[ VFS.leafAttrs
"plugin"
(toMap { load = vfs.lwip, label = "uplink" })
]
]
, VFS.dir
"nix"
@ -41,5 +48,5 @@ in λ(args : List Text) →
]
]
}
, resources = Init.Resources::{ caps = 256, ram = Sigil.units.MiB 64 }
, resources = Init.Resources::{ caps = 512, ram = Sigil.units.MiB 384 }
}

View File

@ -10,18 +10,19 @@ in {
args = lib.strings.splitString " "
config.systemd.services.tor.serviceConfig.ExecStart;
tor' = lib.getEris' "bin" pkgs.tor "tor";
lwip' = lib.getEris "lib" pkgs.genodePackages.lwip;
lwip' = lib.getEris "lib" pkgs.genodePackages.vfs_lwip;
pipe' = lib.getEris "lib" pkgs.genodePackages.vfs_pipe;
in {
binary = builtins.head args;
package = pkgs.tor;
extraErisInputs = [ tor' lwip' ];
configFile = pkgs.writeText "tor.dhall"
"${./tor.dhall} ${toDhall args} ${lwip'.cap}";
uplinks.eth0 = {
driver = "virtio";
dump = true;
verbose = true;
};
extraErisInputs = [ tor' lwip' pipe' ];
configFile = pkgs.writeText "tor.dhall" "${./tor.dhall} ${toDhall args} ${
toDhall {
lwip = lwip'.cap;
pipe = pipe'.cap;
}
}";
uplinks.uplink.driver = "ipxe";
};
};

View File

@ -2,9 +2,12 @@
name = "tor";
machine = { config, lib, pkgs, ... }: {
# genode.core.storeBackend = "fs";
# hardware.genode.usb.enable = true;
# hardware.genode.usb.storage.enable = true;
virtualisation.memorySize = 768;
genode.gui.consoleLog.enable = true;
genode.core.storeBackend = "fs";
hardware.genode.usb.enable = true;
hardware.genode.usb.storage.enable = true;
services.tor = {
enable = true;