nixos/modules/sway/sway_conf.nix
2023-12-15 15:50:45 -07:00

100 lines
2.4 KiB
Nix

{ lib, config, pkgs, ... }:
{
options.swaywm = {
enable = lib.mkEnableOption "Enable sway window manager.";
useNonFree = lib.mkOption {
default = false;
example = true;
description = "Whether to enable non-free software in the sway config";
};
systemPackages = lib.mkOption {
default = [];
description = "Add any additional packages desired. Merged with sway defaults.";
};
};
config = lib.mkIf config.swaywm.enable {
nixpkgs.config.allowUnfree = config.swaywm.useNonFree;
###
## XDG portal setup
###
xdg.portal = {
config = {
common = {
default = [
"wlr"
];
};
};
extraPortals = with pkgs; [
# xdg-desktop-portal-kde
xdg-desktop-portal-gtk
];
wlr.enable = true;
enable = true;
};
xdg.sounds.enable = true;
###
## System Packages
###
environment.systemPackages = with pkgs; lib.mkMerge [
[
git
glib # gsettings
grim
pavucontrol
slurp
swaylock
swayidle
wget
wl-clipboard
xdg-utils
zsh
]
config.swaywm.systemPackages
];
programs.zsh.enable = true;
programs.steam.enable = true;
###
## Services
###
services.openssh.enable = true;
services.dbus.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# Firewall
networking.firewall = {
enable = true;
allowedTCPPortRanges = [
{from = 1714; to = 1764;} # KDE Connnect
];
allowedUDPPortRanges = [
{from = 1714; to = 1764;} # KDE Connnect
];
};
###
## Misc
###
sound.enable = true;
# Necessary for home-manager sway setup
security.polkit.enable = true;
hardware.opengl = {
enable = true;
driSupport = true;
};
};
}