[roles] No config change unless enabled

This commit is contained in:
2024-10-05 18:17:42 -07:00
parent 1a857399a6
commit ff3a0a4738
8 changed files with 58 additions and 48 deletions

View File

@@ -10,7 +10,7 @@ in
enable = mkEnableOption "Enable the audio role"; enable = mkEnableOption "Enable the audio role";
}; };
config = config = mkIf cfg.enable
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
paprefs paprefs

View File

@@ -10,7 +10,7 @@ in
enable = mkEnableOption "Enable the bluetooth role"; enable = mkEnableOption "Enable the bluetooth role";
}; };
config = config = mkIf cfg.enable
{ {
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true; hardware.bluetooth.powerOnBoot = true;

View File

@@ -25,7 +25,7 @@ in
steam-library steam-library
youtube youtube
]); ]);
in { in mkIf cfg.enable {
users.extraUsers.kodi.isNormalUser = true; users.extraUsers.kodi.isNormalUser = true;
networking.firewall = { networking.firewall = {
@@ -50,7 +50,7 @@ in
enable = true; enable = true;
greeter.enable = false; greeter.enable = false;
}; };
displayManager.sddm.enable = mkForce false; displayManager.sddm.enable = mkForce false;
}; };
displayManager = mkIf (!cfg.wayland) { displayManager = mkIf (!cfg.wayland) {
autoLogin.enable = true; autoLogin.enable = true;

View File

@@ -16,15 +16,16 @@ in
}; };
}; };
config = { config = mkIf cfg.enable
fileSystems."/media" = { {
device = "10.0.0.43:/media"; fileSystems."/media" = {
fsType = "nfs"; device = "10.0.0.43:/media";
options = [ fsType = "nfs";
"defaults" options = [
"nofail" "defaults"
"softreval" "nofail"
]; "softreval"
];
};
}; };
};
} }

View File

@@ -2,18 +2,22 @@
with lib; with lib;
let
cfg = config.roles.printing;
in
{ {
options.roles.printing = { options.roles.printing = {
enable = mkEnableOption "Enable default printing setup"; enable = mkEnableOption "Enable default printing setup";
}; };
config = { config = mkIf cfg.enable
services.printing.enable = true; {
services.printing.enable = true;
services.avahi = { services.avahi = {
enable = true; enable = true;
nssmdns4 = true; nssmdns4 = true;
openFirewall = true; openFirewall = true;
};
}; };
};
} }

View File

@@ -10,30 +10,31 @@ in
enable = mkEnableOption "Enable the spotifyd role"; enable = mkEnableOption "Enable the spotifyd role";
}; };
config = { config = mkIf cfg.enable
roles.audio.enable = true; {
roles.audio.enable = true;
services.spotifyd = { services.spotifyd = {
enable = true; enable = true;
settings = { settings = {
global = { global = {
use_mpris = false; use_mpris = false;
backend = "alsa"; backend = "alsa";
device = "sysdefault"; device = "sysdefault";
bitrate = 320; bitrate = 320;
cache_path = ""; cache_path = "";
zeroconf_port = 1234; zeroconf_port = 1234;
autoplay = false; autoplay = false;
};
}; };
}; };
};
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
1234 1234
57621 57621
]; ];
networking.firewall.allowedUDPPorts = [ networking.firewall.allowedUDPPorts = [
5353 5353
]; ];
}; };
} }

View File

@@ -21,7 +21,7 @@ in
kidsPackages = with pkgs; [ kidsPackages = with pkgs; [
firefox firefox
]; ];
in { in mkIf cfg.enable {
users.users.johno = { users.users.johno = {
isNormalUser = true; isNormalUser = true;
description = "John Ogle"; description = "John Ogle";

View File

@@ -2,13 +2,17 @@
with lib; with lib;
let
cfg = config.roles.virtualisation;
in
{ {
options.roles.virtualisation = { options.roles.virtualisation = {
enable = mkEnableOption "Enable virtualisation"; enable = mkEnableOption "Enable virtualisation";
}; };
config = { config = mkIf cfg.enable
virtualisation.libvirtd.enable = true; {
programs.virt-manager.enable = true; virtualisation.libvirtd.enable = true;
}; programs.virt-manager.enable = true;
};
} }