{ config, pkgs, lib, ... }: let cfg = config.local.programs.communication.skype; hostRunPackage = pkgs.writeScript "cont-run" '' sudo nixos-container run skype -- su -l kira -c "$*" ''; 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 ]; local.security.sudo.nopasswd = [{ commands = [ hostSkype ]; }]; local.sound.systemWide = true; containers.skype = { autoStart = true; ephemeral = true; bindMounts = lib.mkMerge [ { "/tmp/.X11-unix" = { }; } (lib.mkIf config.hardware.graphics.enable { "/run/opengl-driver/lib" = { }; }) (lib.mkIf config.hardware.graphics.enable32Bit { "/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; }; }; users.users.kira = { isNormalUser = true; home = "/home/kira"; password = "hello"; extraGroups = [ "pulse-access" ]; packages = [ cfg.package ]; }; environment.sessionVariables = { DISPLAY = ":0"; PULSE_SERVER = "tcp:127.0.0.1:4713"; }; }; }; }; }