nixconf/modules/nixos/core/desktops/default.nix
2024-05-07 00:45:21 -04:00

89 lines
2.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib) types;
cfg = config.mtxyz;
in
{
options.mtxyz.graphical = with lib; {
desktop = mkOption {
description = "Graphical desktop environment to use";
type = with types; nullOr (enum [ ]);
default = null;
};
};
# Config for all desktops
config = lib.mkIf (!isNull cfg.graphical.desktop) {
sound.enable = true;
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
pulse.enable = true;
alsa.enable = true;
jack.enable = true;
};
networking.networkmanager.enable = lib.mkDefault true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
virtualisation.waydroid.enable = lib.mkDefault (!cfg.platform.minimal);
services.flatpak.enable = lib.mkDefault (!cfg.platform.minimal);
boot.plymouth.enable = true;
boot.initrd.verbose = false;
boot.kernelParams = [ "quiet" ];
services.xserver = {
enable = true;
xkb = {
layout = "us";
options = "caps:super";
};
libinput.enable = true;
};
services.printing = {
enable = true;
webInterface = false;
drivers = with pkgs; [ brlaser gutenprint gutenprintBin ];
};
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
(nerdfonts.override {
fonts = [ "SourceCodePro" "FantasqueSansMono" "CommitMono" ];
})
];
fontconfig = {
defaultFonts = {
sansSerif = [ "FantasqueSansMono Nerd Font Mono" ];
monospace = [ "CommitMono Nerd Font Mono" ];
};
};
};
services.tlp = {
enable = cfg.platform.portable;
settings = lib.mkDefault {
START_CHARGE_THRESH_BAT0 = 70;
STOP_CHARGE_THRESH_BAT0 = 80;
};
};
services.power-profiles-daemon.enable = !config.services.tlp.enable;
};
}