diff --git a/roles/audio/default.nix b/roles/audio/default.nix index 7734aad..7e2e8e5 100644 --- a/roles/audio/default.nix +++ b/roles/audio/default.nix @@ -10,7 +10,7 @@ in enable = mkEnableOption "Enable the audio role"; }; - config = + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ paprefs diff --git a/roles/bluetooth/default.nix b/roles/bluetooth/default.nix index a940235..5a655c1 100644 --- a/roles/bluetooth/default.nix +++ b/roles/bluetooth/default.nix @@ -10,7 +10,7 @@ in enable = mkEnableOption "Enable the bluetooth role"; }; - config = + config = mkIf cfg.enable { hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = true; diff --git a/roles/kodi/default.nix b/roles/kodi/default.nix index e930e36..76e10d6 100644 --- a/roles/kodi/default.nix +++ b/roles/kodi/default.nix @@ -25,7 +25,7 @@ in steam-library youtube ]); - in { + in mkIf cfg.enable { users.extraUsers.kodi.isNormalUser = true; networking.firewall = { @@ -50,7 +50,7 @@ in enable = true; greeter.enable = false; }; - displayManager.sddm.enable = mkForce false; + displayManager.sddm.enable = mkForce false; }; displayManager = mkIf (!cfg.wayland) { autoLogin.enable = true; diff --git a/roles/nfs-mounts/default.nix b/roles/nfs-mounts/default.nix index 8f25272..017a0b2 100644 --- a/roles/nfs-mounts/default.nix +++ b/roles/nfs-mounts/default.nix @@ -16,15 +16,16 @@ in }; }; - config = { - fileSystems."/media" = { - device = "10.0.0.43:/media"; - fsType = "nfs"; - options = [ - "defaults" - "nofail" - "softreval" - ]; + config = mkIf cfg.enable + { + fileSystems."/media" = { + device = "10.0.0.43:/media"; + fsType = "nfs"; + options = [ + "defaults" + "nofail" + "softreval" + ]; + }; }; - }; } diff --git a/roles/printing/default.nix b/roles/printing/default.nix index 0ac8f3d..18e96ed 100644 --- a/roles/printing/default.nix +++ b/roles/printing/default.nix @@ -2,18 +2,22 @@ with lib; +let + cfg = config.roles.printing; +in { options.roles.printing = { enable = mkEnableOption "Enable default printing setup"; }; - config = { - services.printing.enable = true; + config = mkIf cfg.enable + { + services.printing.enable = true; - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; }; - }; } diff --git a/roles/spotifyd/default.nix b/roles/spotifyd/default.nix index 595aac1..2db7c22 100644 --- a/roles/spotifyd/default.nix +++ b/roles/spotifyd/default.nix @@ -10,30 +10,31 @@ in enable = mkEnableOption "Enable the spotifyd role"; }; - config = { - roles.audio.enable = true; + config = mkIf cfg.enable + { + roles.audio.enable = true; - services.spotifyd = { - enable = true; - settings = { - global = { - use_mpris = false; - backend = "alsa"; - device = "sysdefault"; - bitrate = 320; - cache_path = ""; - zeroconf_port = 1234; - autoplay = false; + services.spotifyd = { + enable = true; + settings = { + global = { + use_mpris = false; + backend = "alsa"; + device = "sysdefault"; + bitrate = 320; + cache_path = ""; + zeroconf_port = 1234; + autoplay = false; + }; }; }; - }; - networking.firewall.allowedTCPPorts = [ - 1234 - 57621 - ]; - networking.firewall.allowedUDPPorts = [ - 5353 - ]; - }; + networking.firewall.allowedTCPPorts = [ + 1234 + 57621 + ]; + networking.firewall.allowedUDPPorts = [ + 5353 + ]; + }; } diff --git a/roles/users/default.nix b/roles/users/default.nix index 123eac7..5e05e35 100644 --- a/roles/users/default.nix +++ b/roles/users/default.nix @@ -21,7 +21,7 @@ in kidsPackages = with pkgs; [ firefox ]; - in { + in mkIf cfg.enable { users.users.johno = { isNormalUser = true; description = "John Ogle"; diff --git a/roles/virtualisation/default.nix b/roles/virtualisation/default.nix index 90b48f3..7232362 100644 --- a/roles/virtualisation/default.nix +++ b/roles/virtualisation/default.nix @@ -2,13 +2,17 @@ with lib; +let + cfg = config.roles.virtualisation; +in { options.roles.virtualisation = { enable = mkEnableOption "Enable virtualisation"; }; - config = { - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - }; + config = mkIf cfg.enable + { + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + }; }