nixos-configuration/modules/desktop/default.nix
Vinzenz Schroeter 1b7989336e convoluted solution looking for a problem
unified modules structure
2023-09-24 10:15:53 +02:00

134 lines
2.9 KiB
Nix

modulesCfg: {
config,
pkgs,
lib,
...
}: let
isEnabled = modulesCfg.enableDesktop;
cfg = config.my.desktop;
in {
imports = lib.optionals isEnabled [
<home-manager/nixos>
./gnome.nix
./kde.nix
./vinzenz.nix
./ronja.nix
./gaming.nix
];
options.my.modulesCfg.enableDesktop = lib.mkEnableOption "enable desktop module";
options.my.desktop = {
enable = lib.mkEnableOption "desktop";
gnome.enable = lib.mkEnableOption "gnome desktop";
kde.enable = lib.mkEnableOption "KDE desktop";
ronja.enable = lib.mkEnableOption "user ronja";
vinzenz.enable = lib.mkEnableOption "user vinzenz";
gaming.enable = lib.mkEnableOption "gaming with wine";
};
config = lib.mkIf cfg.enable {
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
services = {
# Enable the X11 windowing system / wayland depending on DE
xserver.enable = true;
# Enable CUPS to print documents.
printing.enable = true;
# Enable the OpenSSH daemon.
openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
};
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
programs = {
steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};
};
# unblock kde connect / gsconnect
networking = {
networkmanager.enable = true;
firewall.enable = true;
firewall = {
allowedTCPPortRanges = [
{
# KDE Connect
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
# KDE Connect
from = 1714;
to = 1764;
}
];
};
};
systemd = {
# save some boot time because nothing actually requires network connectivity
services.NetworkManager-wait-online.enable = false;
extraConfig = ''
DefaultTimeoutStopSec=12s
'';
};
programs = {
zsh.enable = true;
git = {
enable = true;
package = pkgs.gitFull;
};
};
environment = {
pathsToLink = ["/share/zsh"];
systemPackages = with pkgs; [
lm_sensors
tldr
ncdu
];
};
nixpkgs.config.permittedInsecurePackages = [
"electron-12.2.3"
];
fonts = {
fontconfig.defaultFonts.monospace = ["FiraCode Nerd Font"];
fonts = with pkgs; [
(nerdfonts.override {fonts = ["FiraCode"];})
];
};
};
}