system/modules/nixos/programs/communication/skype.nix

74 lines
1.9 KiB
Nix
Raw Permalink Normal View History

{ config, pkgs, lib, ... }:
let
cfg = config.local.programs.communication.skype;
hostRunPackage = pkgs.writeScript "cont-run" ''
2024-09-30 20:13:34 +03:00
sudo nixos-container run skype -- su -l jan -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.sound.systemWide = true;
containers.skype = {
autoStart = true;
ephemeral = true;
bindMounts = lib.mkMerge [
{
"/tmp/.X11-unix" = { };
2024-09-30 20:13:34 +03:00
"/home/jan/downloads/skype" = { isReadonly = false; };
}
(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; };
};
2024-09-30 20:13:34 +03:00
users.users.jan = {
isNormalUser = true;
2024-09-30 20:13:34 +03:00
home = "/home/jan";
password = "hello";
extraGroups = [ "pulse-access" ];
packages = [ cfg.package ];
};
environment.sessionVariables = {
DISPLAY = ":0";
PULSE_SERVER = "tcp:127.0.0.1:4713";
};
};
};
};
}