118 lines
2.9 KiB
Nix
118 lines
2.9 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
let
|
|
cfg = config.local.programs.communication.skype;
|
|
|
|
hostAddress = "192.168.7.10";
|
|
localAddress = "192.168.7.20";
|
|
|
|
hostRunPackage = pkgs.writeScript "cont-run" ''
|
|
host=skype.containers
|
|
if [ -z "$(ssh-keygen -F $host)" ]; then
|
|
ssh-keyscan -H $host >> ~/.ssh/known_hosts
|
|
fi
|
|
ssh -o PubkeyAuthentication=no kira@$host $@
|
|
'';
|
|
|
|
hostPackageScript = pkgs.writeScriptBin "${cfg.package.meta.mainProgram}" ''
|
|
${hostRunPackage} ${cfg.package.meta.mainProgram} $@
|
|
'';
|
|
|
|
hostSkype = pkgs.runCommand "${cfg.package.meta.mainProgram}" { } ''
|
|
mkdir $out
|
|
cp -r ${hostPackageScript}/bin $out/bin
|
|
cp -r ${cfg.package}/share $out/share
|
|
'';
|
|
in
|
|
{
|
|
options.local.programs.communication.skype = with lib; {
|
|
enable = mkEnableOption "skype";
|
|
package = mkPackageOption pkgs "skypeforlinux" { };
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = [ hostSkype ];
|
|
|
|
hardware.pulseaudio = {
|
|
systemWide = true;
|
|
support32Bit = true;
|
|
tcp = {
|
|
enable = true;
|
|
anonymousClients.allowedIpRanges = [ "127.0.0.1" "192.168.7.0/24" ];
|
|
};
|
|
};
|
|
|
|
networking = {
|
|
firewall = {
|
|
allowedTCPPorts = [ 4713 ];
|
|
trustedInterfaces = [ "ve-*" ];
|
|
};
|
|
nat = {
|
|
enable = true;
|
|
internalInterfaces = [ "ve-skype" ];
|
|
externalInterface = "wg0";
|
|
};
|
|
};
|
|
|
|
containers.skype = {
|
|
autoStart = true;
|
|
ephemeral = true;
|
|
|
|
privateNetwork = true;
|
|
inherit hostAddress localAddress;
|
|
|
|
bindMounts = {
|
|
"/tmp/.X11-unix" = { };
|
|
"/etc/ssh/keys" = {
|
|
isReadOnly = false;
|
|
hostPath = "/persistence/per-machine/skype/etc/ssh/keys";
|
|
};
|
|
"/run/opengl-driver/lib" = { };
|
|
"/run/opengl-driver-32/lib" = { };
|
|
};
|
|
|
|
config = { pkgs, ... }: {
|
|
system.stateVersion = "23.11";
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
fonts = {
|
|
inherit (config.fonts) enableDefaultPackages packages;
|
|
fontconfig = { inherit (config.fonts.fontconfig) defaultFonts; };
|
|
};
|
|
|
|
services.openssh = {
|
|
enable = true;
|
|
settings = {
|
|
PasswordAuthentication = true;
|
|
MaxAuthTries = 2;
|
|
};
|
|
hostKeys = [
|
|
{
|
|
bits = 4096;
|
|
path = "/etc/ssh/keys/ssh_host_rsa_key";
|
|
type = "rsa";
|
|
}
|
|
{
|
|
path = "/etc/ssh/keys/ssh_host_ed25519_key";
|
|
type = "ed25519";
|
|
}
|
|
];
|
|
};
|
|
|
|
users.users.kira = {
|
|
isNormalUser = true;
|
|
home = "/home/kira";
|
|
password = "hello";
|
|
extraGroups = [ "pulse-access" ];
|
|
packages = [cfg.package];
|
|
};
|
|
|
|
environment.sessionVariables = {
|
|
DISPLAY = ":0";
|
|
PULSE_SERVER = "tcp:${hostAddress}:4713";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|