nixos-configuration/modules/desktop/default.nix

134 lines
2.9 KiB
Nix
Raw Normal View History

modulesCfg: {
2023-09-09 15:44:15 +02:00
config,
pkgs,
lib,
...
}: let
isEnabled = modulesCfg.enableDesktop;
2023-09-09 15:44:15 +02:00
cfg = config.my.desktop;
in {
imports = lib.optionals isEnabled [
2023-09-11 19:16:26 +02:00
<home-manager/nixos>
2023-09-09 15:44:15 +02:00
./gnome.nix
./kde.nix
2023-09-11 19:16:26 +02:00
./vinzenz.nix
./ronja.nix
2023-09-23 11:29:46 +02:00
./gaming.nix
2023-09-09 15:44:15 +02:00
];
options.my.modulesCfg.enableDesktop = lib.mkEnableOption "enable desktop module";
2023-09-09 15:44:15 +02:00
options.my.desktop = {
enable = lib.mkEnableOption "desktop";
gnome.enable = lib.mkEnableOption "gnome desktop";
2023-09-11 21:49:40 +02:00
kde.enable = lib.mkEnableOption "KDE desktop";
ronja.enable = lib.mkEnableOption "user ronja";
vinzenz.enable = lib.mkEnableOption "user vinzenz";
2023-09-23 11:29:46 +02:00
gaming.enable = lib.mkEnableOption "gaming with wine";
2023-09-09 15:44:15 +02:00
};
config = lib.mkIf cfg.enable {
2023-09-11 19:16:26 +02:00
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
2023-09-09 15:44:15 +02:00
services = {
# Enable the X11 windowing system / wayland depending on DE
xserver.enable = true;
# Enable CUPS to print documents.
printing.enable = true;
2023-09-10 14:12:01 +02:00
2023-09-11 19:16:26 +02:00
# Enable the OpenSSH daemon.
openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
2023-09-09 15:44:15 +02:00
};
# 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
2023-09-11 19:16:26 +02:00
networking = {
networkmanager.enable = true;
firewall.enable = true;
firewall = {
allowedTCPPortRanges = [
{
# KDE Connect
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
# KDE Connect
from = 1714;
to = 1764;
}
];
};
};
2023-09-17 14:03:37 +02:00
systemd = {
# save some boot time because nothing actually requires network connectivity
services.NetworkManager-wait-online.enable = false;
extraConfig = ''
DefaultTimeoutStopSec=12s
'';
};
2023-09-11 19:16:26 +02:00
programs = {
zsh.enable = true;
git = {
enable = true;
package = pkgs.gitFull;
};
};
environment = {
pathsToLink = ["/share/zsh"];
systemPackages = with pkgs; [
lm_sensors
tldr
ncdu
2023-09-09 15:44:15 +02:00
];
};
2023-09-11 21:00:02 +02:00
nixpkgs.config.permittedInsecurePackages = [
"electron-12.2.3"
];
2023-09-17 16:54:18 +02:00
fonts = {
2023-09-17 16:56:11 +02:00
fontconfig.defaultFonts.monospace = ["FiraCode Nerd Font"];
2023-09-17 16:54:18 +02:00
fonts = with pkgs; [
(nerdfonts.override {fonts = ["FiraCode"];})
];
};
2023-09-09 15:44:15 +02:00
};
}