nixos-config/modules/desktop/default.nix

115 lines
2.6 KiB
Nix

{ lib
, pkgs
, config
, ...
}:
with lib; let
cfg = config.eboskma.desktop;
in
{
options.eboskma.desktop = {
enable = mkEnableOption "Enable default desktop configuration";
wayland = mkOption {
description = "Configure for wayland";
type = types.bool;
default = false;
};
home-manager = mkOption {
description = "Enable home-manager for this desktop";
type = types.bool;
default = false;
};
};
config = mkIf cfg.enable {
programs = {
dconf.enable = true;
fuse.userAllowOther = true;
seahorse.enable = true;
sway = mkIf cfg.wayland {
enable = true;
wrapperFeatures = {
gtk = true;
base = true;
};
extraPackages = with pkgs; [
swaylock-effects
swayidle
];
};
hyprland = mkIf cfg.wayland {
enable = true;
# Required when also using the Home Manager module
# See the wiki: https://wiki.hyprland.org/Nix/#modules-mixnmatch
package = null;
};
};
xdg = {
mime.enable = true;
menus.enable = true;
icons.enable = true;
sounds.enable = true;
autostart.enable = true;
portal = {
enable = true;
wlr.enable = cfg.wayland;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};
};
services = {
dbus.packages = [ pkgs.gcr ];
avahi.publish.workstation = true;
gvfs.enable = true;
pcscd.enable = true;
ratbagd.enable = true;
teamviewer.enable = mkIf (pkgs.system == "x86_64-linux") true;
};
security = {
pam.services.swaylock = {
unixAuth = true;
setLoginUid = true;
enableGnomeKeyring = true;
allowNullPassword = true;
updateWtmp = true;
startSession = true;
};
pki.certificates = [ (builtins.readFile ./horus-ca.pem) ];
wrappers = {
fusermount.source = "${pkgs.fuse}/bin/fusermount";
};
};
environment = {
sessionVariables = mkIf cfg.wayland {
_JAVA_AWT_WM_NONREPARENTING = "1";
MOZ_ENABLE_WAYLAND = "1";
MOZ_DBUS_REMOTE = "1";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORMTHEME = "qt5ct";
SDL_VIDEODRIVER = "wayland";
SSH_AUTH_SOCK = ''''${XDG_RUNTIME_DIR}/ssh-agent'';
AMD_VULKAN_ICD = "RADV";
NIXOS_OZONE_WL = "1";
};
etc = {
"X11/xkb".source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
};
systemPackages = with pkgs; [
piper
];
};
};
}