refactor(nixosmodules): move desktop configs to a module

This commit is contained in:
Mohammad Rafiq 2025-05-03 12:59:13 +08:00
parent fc7d95acfd
commit 1a3ef0605b
No known key found for this signature in database
7 changed files with 62 additions and 42 deletions

59
modules/nixos/de.nix Normal file
View file

@ -0,0 +1,59 @@
{
config,
lib,
...
}:
let
moduleName = "de";
cfg = config."${moduleName}";
in
{
options = {
"${moduleName}" = {
enable = lib.mkEnableOption "Enable ${moduleName}.";
type = lib.mkOption {
type = lib.types.str;
default = "";
example = "hyprland";
description = "What desktop environment should be installed on the host.";
};
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
# Enable audio and other common config
security.rtkit.enable = true;
services.pipewire = {
enable = true;
extraConfig = { };
jack.enable = true;
pulse.enable = true;
alsa = {
enable = true;
support32Bit = true;
};
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
}
(lib.mkIf config.hmModules.enable {
home-manager.users."${config.nixosModules.mainUser}".services.spotifyd = {
enable = true;
settings = {
global = {
device_name = "${config.nixosModules.hostname}";
device_type = "computer";
zeroconf_port = 5353;
};
};
};
networking.firewall.allowedTCPPorts = [ 5353 ];
networking.firewall.allowedUDPPorts = [ 5353 ];
})
]
);
}

View file

@ -10,6 +10,7 @@ in
{
imports = [
./boot.nix
./de.nix
./hardware.nix
./nix-config.nix
./gaming.nix