diff --git a/nixos-modules/services/default.nix b/nixos-modules/services/default.nix index 9a90ad8..fb0bf3e 100644 --- a/nixos-modules/services/default.nix +++ b/nixos-modules/services/default.nix @@ -1,3 +1 @@ -{ - imports = [ ./tor.nix ]; -} \ No newline at end of file +{ imports = [ ./tor.nix ]; } diff --git a/nixos-modules/services/tor.dhall b/nixos-modules/services/tor.dhall index 51eb7bd..ce97ac7 100644 --- a/nixos-modules/services/tor.dhall +++ b/nixos-modules/services/tor.dhall @@ -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 } } diff --git a/nixos-modules/services/tor.nix b/nixos-modules/services/tor.nix index 6523812..8cecfe6 100644 --- a/nixos-modules/services/tor.nix +++ b/nixos-modules/services/tor.nix @@ -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"; }; }; diff --git a/tests/tor.nix b/tests/tor.nix index 6c1342c..9b1a3d3 100644 --- a/tests/tor.nix +++ b/tests/tor.nix @@ -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;