disable wireguard, enable sing-box on amd, dell, tinyproxy
This commit is contained in:
parent
c2755b492a
commit
5135c88511
@ -1,4 +1,4 @@
|
|||||||
{ inputs, config, lib, pkgs, ... }: {
|
{ inputs, config, lib, pkgs, secretsDir, ... }: {
|
||||||
imports = with inputs.self; [
|
imports = with inputs.self; [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
@ -78,12 +78,12 @@
|
|||||||
deviceSpecific.enableVirtualisation = true;
|
deviceSpecific.enableVirtualisation = true;
|
||||||
# VPN
|
# VPN
|
||||||
deviceSpecific.vpn.tailscale.enable = true;
|
deviceSpecific.vpn.tailscale.enable = true;
|
||||||
sops.secrets.wg-ataraxia.sopsFile = inputs.self.secretsDir + /wg-configs.yaml;
|
deviceSpecific.vpn.sing-box.enable = true;
|
||||||
networking.wg-quick.interfaces.wg0.autostart = false;
|
deviceSpecific.vpn.sing-box.config = "ataraxia-singbox";
|
||||||
networking.wg-quick.interfaces.wg0.configFile = config.sops.secrets.wg-ataraxia.path;
|
|
||||||
# Mount
|
# Mount
|
||||||
# TODO: fix sops
|
# TODO: fix sops
|
||||||
sops.secrets.files-veracrypt.sopsFile = inputs.self.secretsDir + /amd-workstation/misc.yaml;
|
sops.secrets.files-veracrypt.sopsFile = secretsDir + /amd-workstation/misc.yaml;
|
||||||
services.cryptmount.files-veracrypt = {
|
services.cryptmount.files-veracrypt = {
|
||||||
what = "/dev/disk/by-partuuid/15fa11a1-a6d8-4962-9c03-74b209d7c46a";
|
what = "/dev/disk/by-partuuid/15fa11a1-a6d8-4962-9c03-74b209d7c46a";
|
||||||
where = "/media/files";
|
where = "/media/files";
|
||||||
@ -112,7 +112,7 @@
|
|||||||
services.openssh.settings.PermitRootLogin = lib.mkForce "without-password";
|
services.openssh.settings.PermitRootLogin = lib.mkForce "without-password";
|
||||||
services.ratbagd.enable = true;
|
services.ratbagd.enable = true;
|
||||||
# Networking
|
# Networking
|
||||||
networking.firewall.allowedTCPPorts = [ 8000 5900 52736 3456 ];
|
networking.firewall.allowedTCPPorts = [ 8000 5900 52736 3456 1080 ];
|
||||||
networking.nameservers = [ "10.10.10.1" ];
|
networking.nameservers = [ "10.10.10.1" ];
|
||||||
networking.defaultGateway = "10.10.10.1";
|
networking.defaultGateway = "10.10.10.1";
|
||||||
networking.bridges.br0.interfaces = [ "enp9s0" ];
|
networking.bridges.br0.interfaces = [ "enp9s0" ];
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
deviceSpecific.isGaming = false;
|
deviceSpecific.isGaming = false;
|
||||||
deviceSpecific.enableVirtualisation = true;
|
deviceSpecific.enableVirtualisation = true;
|
||||||
deviceSpecific.vpn.tailscale.enable = true;
|
deviceSpecific.vpn.tailscale.enable = true;
|
||||||
sops.secrets.wg-dell.sopsFile = inputs.self.secretsDir + /wg-configs.yaml;
|
deviceSpecific.vpn.sing-box.enable = true;
|
||||||
networking.wg-quick.interfaces.wg0.autostart = false;
|
deviceSpecific.vpn.sing-box.config = "dell-singbox";
|
||||||
networking.wg-quick.interfaces.wg0.configFile = config.sops.secrets.wg-dell.path;
|
|
||||||
|
|
||||||
boot.blacklistedKernelModules = [
|
boot.blacklistedKernelModules = [
|
||||||
"psmouse"
|
"psmouse"
|
||||||
|
@ -89,6 +89,14 @@ with types; {
|
|||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
sing-box.enable = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
sing-box.config = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
wireguard = {
|
wireguard = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
|
@ -31,6 +31,7 @@ with lib; {
|
|||||||
youtube-to-mpv = prev.callPackage ./packages/youtube-to-mpv.nix { term = config.defaultApplications.term.cmd; };
|
youtube-to-mpv = prev.callPackage ./packages/youtube-to-mpv.nix { term = config.defaultApplications.term.cmd; };
|
||||||
yt-archivist = prev.callPackage ./packages/yt-archivist { };
|
yt-archivist = prev.callPackage ./packages/yt-archivist { };
|
||||||
yt-dlp = master.yt-dlp;
|
yt-dlp = master.yt-dlp;
|
||||||
|
sing-box = master.sing-box;
|
||||||
steam = prev.steam.override {
|
steam = prev.steam.override {
|
||||||
extraPkgs = pkgs: with pkgs; [ mono libkrb5 keyutils ];
|
extraPkgs = pkgs: with pkgs; [ mono libkrb5 keyutils ];
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,30 @@
|
|||||||
{ ... }: {
|
{ config, secretsDir, ... }: {
|
||||||
|
sops.secrets.tinyproxy-singbox = {
|
||||||
|
sopsFile = secretsDir + /proxy.yaml;
|
||||||
|
restartUnits = [ "container@tinyproxy.service" ];
|
||||||
|
mode = "0600";
|
||||||
|
};
|
||||||
containers.tinyproxy = {
|
containers.tinyproxy = {
|
||||||
extraFlags = [ "-U" ];
|
# extraFlags = [ "-U" ];
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
ephemeral = true;
|
ephemeral = true;
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
hostBridge = "br0";
|
hostBridge = "br0";
|
||||||
localAddress = "10.10.10.6/24";
|
localAddress = "10.10.10.6/24";
|
||||||
config = { ... }: {
|
bindMounts."/tmp/sing-box.json".hostPath = config.sops.secrets.tinyproxy-singbox.path;
|
||||||
services.privoxy = {
|
config = { pkgs, lib, ... }: {
|
||||||
enable = true;
|
environment.systemPackages = [ pkgs.dnsutils pkgs.kitty ];
|
||||||
settings = {
|
systemd.packages = [ pkgs.sing-box ];
|
||||||
listen-address = "10.10.10.6:8888";
|
systemd.services.sing-box = {
|
||||||
toggle = false;
|
preStart = ''
|
||||||
keep-alive-timeout = 300;
|
umask 0077
|
||||||
default-server-timeout = 60;
|
mkdir -p /etc/sing-box
|
||||||
connection-sharing = false;
|
cp /tmp/sing-box.json /etc/sing-box/config.json
|
||||||
|
'';
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
User = "root";
|
||||||
|
Group = "root";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
networking = {
|
networking = {
|
||||||
@ -24,7 +34,7 @@
|
|||||||
useHostResolvConf = false;
|
useHostResolvConf = false;
|
||||||
firewall = {
|
firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [ 8888 ];
|
allowedTCPPorts = [ 8888 8889 ];
|
||||||
rejectPackets = false;
|
rejectPackets = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,28 @@
|
|||||||
{ lib, config, ... }:
|
{ config, lib, pkgs, secretsDir, ... }:
|
||||||
let
|
let
|
||||||
isTailscale = config.deviceSpecific.vpn.tailscale.enable;
|
isTailscale = config.deviceSpecific.vpn.tailscale.enable;
|
||||||
wg = config.deviceSpecific.vpn.wireguard;
|
wg = config.deviceSpecific.vpn.wireguard;
|
||||||
|
sing-box = config.deviceSpecific.vpn.sing-box;
|
||||||
wgIFName = "wg0";
|
wgIFName = "wg0";
|
||||||
isRouteAll = (builtins.elem "0.0.0.0/0" wg.allowedIPs) || (builtins.elem "::0/0" wg.allowedIPs);
|
isRouteAll = (builtins.elem "0.0.0.0/0" wg.allowedIPs) || (builtins.elem "::0/0" wg.allowedIPs);
|
||||||
in {
|
in {
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf sing-box.enable {
|
||||||
|
sops.secrets.${sing-box.config} = {
|
||||||
|
sopsFile = secretsDir + /proxy.yaml;
|
||||||
|
restartUnits = [ "sing-box.service" ];
|
||||||
|
mode = "0600";
|
||||||
|
};
|
||||||
|
systemd.packages = [ pkgs.sing-box ];
|
||||||
|
systemd.services.sing-box = {
|
||||||
|
preStart = ''
|
||||||
|
umask 0077
|
||||||
|
mkdir -p /etc/sing-box
|
||||||
|
cp ${config.sops.secrets.${sing-box.config}.path} /etc/sing-box/config.json
|
||||||
|
'';
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
})
|
||||||
(lib.mkIf isTailscale {
|
(lib.mkIf isTailscale {
|
||||||
services.tailscale.enable = true;
|
services.tailscale.enable = true;
|
||||||
services.tailscale.useRoutingFeatures = "client";
|
services.tailscale.useRoutingFeatures = "client";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user