From 221fcea79d782de14bc863e77762169c20c4c757 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sun, 20 Dec 2020 17:06:38 +0100 Subject: [PATCH] fixup nixosConfigurations --- flake.nix | 7 ++++++ nixos-configurations/default.nix | 12 ++++++++++ nixos-configurations/tor-relay.nix | 35 ++++++++++++++++++++++++++++++ nixos-modules/default.nix | 8 ++++++- 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 nixos-configurations/default.nix create mode 100644 nixos-configurations/tor-relay.nix diff --git a/flake.nix b/flake.nix index 7348653..daf7592 100644 --- a/flake.nix +++ b/flake.nix @@ -132,6 +132,13 @@ # Modules for composing Genode and NixOS import ./nixos-modules { flake = self; }; + nixosConfigurations = + # Demo NixOS configurations + import ./nixos-configurations { + inherit nixpkgs; + genodepkgs = self; + }; + checks = # Checks for continous testing let tests = import ./tests; diff --git a/nixos-configurations/default.nix b/nixos-configurations/default.nix new file mode 100644 index 0000000..6ad2d4d --- /dev/null +++ b/nixos-configurations/default.nix @@ -0,0 +1,12 @@ +{ nixpkgs, genodepkgs }: + +{ + torDemo = nixpkgs.lib.nixosSystem { + system = "x86_64-genode"; + modules = [ + genodepkgs.nixosModules.x86_64 + genodepkgs.nixosModules.nova + (import ./tor-relay.nix) + ]; + }; +} diff --git a/nixos-configurations/tor-relay.nix b/nixos-configurations/tor-relay.nix new file mode 100644 index 0000000..a591e13 --- /dev/null +++ b/nixos-configurations/tor-relay.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: + +{ + + networking.interfaces.eth0 = { + genode.driver = "virtio"; + useDHCP = true; + }; + + services.tor = { + enable = true; + client.enable = false; + extraConfig = '' + Log [general,net,config,fs]debug stdout + ''; + relay = { + enable = true; + 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" ] ] ] + ''; + }; + +} diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix index 8187db1..126a2b4 100644 --- a/nixos-modules/default.nix +++ b/nixos-modules/default.nix @@ -6,7 +6,13 @@ let in { x86_64 = { - imports = [ baseModules ]; + imports = [ + ./genode-core.nix + ./genode-init.nix + ./hardware.nix + ./qemu-vm.nix + ./systemd.nix + ]; nixpkgs = rec { localSystem = "x86_64-linux"; crossSystem = "x86_64-genode";