This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / configs / riot.nix
2.8 kB 88 lines
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 domains = [ 9 "hackerfleet.eu" 10 "hackerfleet.de" 11 ]; 12in 13{ 14 containers.riot = { 15 config = { 16 environment.systemPackages = [ 17 pkgs.git 18 pkgs.jq 19 ]; 20 services.openssh.enable = true; 21 users.users.root.openssh.authorizedKeys.keys = [ 22 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6o6sdTu/CX1LW2Ff5bNDqGEAGwAsjf0iIe5DCdC7YikCct+7x4LTXxY+nDlPMeGcOF88X9/qFwdyh+9E4g0nUAZaeL14Uc14QDqDt/aiKjIXXTepxE/i4JD9YbTqStAnA/HYAExU15yqgUdj2dnHu7OZcGxk0ZR1OY18yclXq7Rq0Fd3pN3lPP1T4QHM9w66r83yJdFV9szvu5ral3/QuxQnCNohTkR6LoJ4Ny2RbMPTRtb+jPbTQYTWUWwV69mB8ot5nRTP4MRM9pu7vnoPF4I2S5DvSnx4C5zdKzsb7zmIvD4AmptZLrXj4UXUf00Xf7Js5W100Ne2yhYyhq+35 riot@lagrange" 23 ]; 24 networking.defaultGateway = "10.233.1.1"; 25 systemd.services.autoswitch = { 26 environment = { 27 NIX_REMOTE = "daemon"; 28 }; 29 wantedBy = [ "multi-user.target" ]; 30 serviceConfig.ExecStart = pkgs.writers.writeDash "autoswitch" '' 31 set -efu 32 if test -e /etc/nixos/configuration.nix; then 33 /run/current-system/sw/bin/nixos-rebuild switch \ 34 -I nixpkgs=channel:$(cat /etc/nixos/channel) \ 35 -I nixos-config=/etc/nixos/configuration.nix \ 36 || : 37 fi 38 ''; 39 unitConfig.X-StopOnRemoval = false; 40 }; 41 system.stateVersion = config.system.nixos.release; 42 }; 43 autoStart = true; 44 enableTun = true; 45 privateNetwork = true; 46 hostAddress = "10.233.1.1"; 47 localAddress = "10.233.1.2"; 48 }; 49 systemd.services."container@riot".restartIfChanged = lib.mkForce false; 50 51 # The container start script sets up the address and route on ve-riot. 52 # Unmanaged keeps networkd from adding its own config there (which makes 53 # the script's `ip route add` fail) and from dropping the script's config 54 # as foreign, also if a later catch-all .network file matches ve-riot. 55 systemd.network.networks."50-ve-riot" = { 56 matchConfig.Name = "ve-riot"; 57 linkConfig.Unmanaged = true; 58 }; 59 60 boot.kernel.sysctl."net.ipv4.ip_forward" = lib.mkDefault 1; 61 62 networking.firewall.extraForwardRules = '' 63 iifname "ve-riot" accept 64 oifname "ve-riot" accept 65 ''; 66 # ssh into the container on 45622 67 networking.nftables.tables.riot = { 68 family = "ip"; 69 content = '' 70 chain prerouting { 71 type nat hook prerouting priority dstnat; policy accept; 72 tcp dport 45622 dnat to ${config.containers.riot.localAddress}:22 73 } 74 chain postrouting { 75 type nat hook postrouting priority srcnat; policy accept; 76 ip saddr ${config.containers.riot.localAddress} masquerade 77 } 78 ''; 79 }; 80 81 # non container stuff 82 83 services.nginx.virtualHosts.riot = { 84 serverName = null; 85 serverAliases = domains; 86 }; 87 88}