~ehmry/sigil

1964540fe213c12e6d8beca51ecce9525eb01aa8 — Emery Hemingway 3 years ago bfe3fe0 nixosModules
WiP! tor test
3 files changed, 64 insertions(+), 31 deletions(-)

M nixos-configurations/default.nix
A nixos-configurations/tor-relay.nix
A tests/tor.nix
M nixos-configurations/default.nix => nixos-configurations/default.nix +1 -31
@@ 6,37 6,7 @@
    modules = [
      genodepkgs.nixosModules.x86_64
      genodepkgs.nixosModules.nova

      ({ config, lib, pkgs, ... }: {
        genode.boot.storeBackend = "usb";
        genode.gui.consoleLog.enable = true;
        networking.interfaces.eth0.genode.driver = "ipxe";
        services.tor = {
          enable = true;
          client.enable = false;
          extraConfig = ''
            Log [general,net,config,fs]debug stdout
          ''; # MaxMemInQueues 64 MBytes
          relay = {
            enable = true;
            contactInfo = "genodepkgs-junk@spam.works";
            port = 80;
            role = "relay";
            bridgeTransports = [ ];
          };
        };
        systemd.services.tor.genode = {
          enable = true;
          interface = "eth0";
          ramQuota = 1024;
          extraVfs = pkgs.writeText "tor.vfs.dhall" ''
            let VFS = (env:DHALL_GENODE).VFS

            in  [ VFS.dir "var" [ VFS.dir "lib" [ VFS.leaf "ram" ] ] ]
          '';
        };
      })

      ./tor-relay.nix
    ];
  };
}

A nixos-configurations/tor-relay.nix => nixos-configurations/tor-relay.nix +29 -0
@@ 0,0 1,29 @@
{ config, lib, pkgs, ... }: {
  genode.boot.storeBackend = "usb";
  genode.gui.consoleLog.enable = true;
  networking.interfaces.eth0.genode.driver = "ipxe";
  services.tor = {
    enable = true;
    client.enable = false;
    extraConfig = ''
      Log [general,net,config,fs]debug stdout
    ''; # MaxMemInQueues 64 MBytes
    relay = {
      enable = true;
      contactInfo = "genodepkgs-junk@spam.works";
      port = 80;
      role = "relay";
      bridgeTransports = [ ];
    };
  };
  systemd.services.tor.genode = {
    enable = true;
    interface = "eth0";
    ramQuota = 1024;
    extraVfs = pkgs.writeText "tor.vfs.dhall" ''
      let VFS = (env:DHALL_GENODE).VFS

      in  [ VFS.dir "var" [ VFS.dir "lib" [ VFS.leaf "ram" ] ] ]
    '';
  };
}

A tests/tor.nix => tests/tor.nix +34 -0
@@ 0,0 1,34 @@
{
  name = "tor";
  machine = { config, pkgs, ... }: {
    imports = [ ../nixos-modules/hardware.nix ../nixos-modules/systemd.nix ];
    hardware.usb.genode.enable = true;
    services.tor = {
      enable = true;
      client.enable = false;
      extraConfig = ''
        Log [general,net,config,fs]debug stdout
        MaxMemInQueues 64 MBytes
      '';
      relay = {
        enable = true;
        contactInfo = "genodepkgs-junk@spam.works";
        port = 80;
        role = "relay";
        bridgeTransports = [ ];
      };
    };
    systemd.services.tor.genode = {
      enable = true;
      interface = "eth1";
      ramQuota = 96;
      extraVfs = pkgs.writeText "tor.vfs.dhall" ''
        let Genode = env:DHALL_GENODE

        let VFS = Genode.VFS

        in  [ VFS.dir "var" [ VFS.dir "lib" [ VFS.leaf "ram" ] ] ]
      '';
    };
  };
}