diff --git a/lib/modules.nix b/lib/modules.nix index e715116b..6f505c46 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -9,6 +9,9 @@ rec { description = desc; }; + # Alias for consistency + mkEnableOpt = lib.mkEnableOption; + # Like mkIf but the predicate is inverted mkElse = pred: do: (lib.mkIf (!pred) do); diff --git a/modules/audio.nix b/modules/audio.nix index e243421f..582f4a01 100644 --- a/modules/audio.nix +++ b/modules/audio.nix @@ -12,25 +12,25 @@ in { ]; options.modules.audio = { - enable = mkBoolOpt false "Configure for realtime audio and enable a bunch of music production tools"; + enable = mkEnableOpt "Audio module"; # TODO: Group these in categories (like instruments/VSTs or sth) # TODO: Make it easier to add many yes/no options, similar to the flatpak stuff # Hosts/Editing - carla.enable = mkBoolOpt false "Enable Carla + guitar-specific stuff"; - bitwig.enable = mkBoolOpt false "Enable Bitwig Studio digital audio workstation"; - tenacity.enable = mkBoolOpt false "Enable Tenacity"; + carla.enable = mkEnableOpt "Carla (VST host)"; + bitwig.enable = mkEnableOpt "Bitwig (Digital audio workstation)"; + tenacity.enable = mkEnableOpt "Tenacity (Audacity fork)"; # Instruments/Plugins - vcvrack.enable = mkBoolOpt false "Enable the VCV-Rack Eurorack simulator"; - vital.enable = mkBoolOpt false "Enable the Vital wavetable Synthesizer"; + vcvrack.enable = mkEnableOpt "VCV-Rack (Eurorack simulator)"; + vital.enable = mkEnableOpt "Vital (Wavetable synthesizer)"; # Misc - faust.enable = mkBoolOpt false "Enable the Faust functional DSP language"; - bottles.enable = mkBoolOpt false "Enable Bottles to emulate windows VSTs (flatpak)"; + faust.enable = mkEnableOpt "Faust (functional DSP language)"; + bottles.enable = mkEnableOpt "Bottles (flatpak)"; yabridge = { - enable = mkBoolOpt false "Enable yabridge + yabridgectl"; + enable = mkEnableOpt "Yabridge (Windows VST plugin manager)"; autoSync = mkBoolOpt false "Sync yabridge plugins on nixos-rebuild"; }; }; @@ -123,7 +123,7 @@ in { (mkUnlink "${config.home.homeDirectory}/.vst3/Vital.vst3"); }) - (mkIf cfg.yabridge.autoSync { + (mkIf (cfg.yabridge.enable && cfg.yabridge.autoSync) { syncYabridge = hm.dag.entryAfter [ "writeBoundary" ] '' yabridgectl sync ''; diff --git a/modules/flatpak.nix b/modules/flatpak.nix index 01c2cbd3..e4c4a37b 100644 --- a/modules/flatpak.nix +++ b/modules/flatpak.nix @@ -15,7 +15,7 @@ in { imports = [ ]; options.modules.flatpak = { - enable = mkBoolOpt false "Enable flatpak support"; + enable = mkEnableOpt "Flatpak module"; fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them"; iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them"; autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild"; @@ -24,10 +24,10 @@ in { # TODO: Add library function to make this easier # TODO: The flatpak name should be included and a list of all enabled apps should be available # TODO: Do this for strings + packages - discord.enable = mkBoolOpt false "Enable Discord"; - spotify.enable = mkBoolOpt false "Enable Spotify"; - flatseal.enable = mkBoolOpt true "Enable Flatseal"; - bottles.enable = mkBoolOpt false "Enable Bottles"; + discord.enable = mkEnableOpt "Discord"; + spotify.enable = mkEnableOpt "Spotify"; + flatseal.enable = mkEnableOpt "Flatseal"; + bottles.enable = mkEnableOpt "Bottles"; # This is mainly used by other modules to allow them to use flatpak packages extraInstall = mkOption { diff --git a/modules/gaming.nix b/modules/gaming.nix index 0e5cc1c1..35c0c518 100644 --- a/modules/gaming.nix +++ b/modules/gaming.nix @@ -13,18 +13,19 @@ in { ]; options.modules.gaming = { - enable = mkBoolOpt false "Enable the Gaming module"; - discordChromium.enable = mkBoolOpt false "Enable Discord as Chromium webapp"; - polymc.enable = mkBoolOpt false "Enable PolyMC for Minecraft (flatpak)"; - bottles.enable = mkBoolOpt false "Enable Bottles to emulate Windows games (flatpak)"; + enable = mkEnableOpt "Gaming module"; + + discordChromium.enable = mkEnableOpt "Discord (Chromium)"; + polymc.enable = mkEnableOpt "PolyMC (flatpak)"; + bottles.enable = mkEnableOpt "Bottles (flatpak)"; noisetorch = { - enable = mkBoolOpt false "Enable Noisetorch"; + enable = mkEnableOpt "Noisetorch"; autostart = mkBoolOpt false "Autostart Noistorch"; }; steam = { - enable = mkBoolOpt false "Enable steam (flatpak)"; + enable = mkEnableOpt "Steam (flatpak)"; protonGE = mkBoolOpt false "Enable Steam Proton GloriousEggroll runner (flatpak)"; gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)"; }; @@ -63,7 +64,7 @@ in { categories = [ "Network" "Chat" ]; }; - systemd.user.services = mkIf cfg.noisetorch.autostart { + systemd.user.services = mkIf (cfg.noisetorch.enable && cfg.noisetorch.autostart) { noisetorch-autostart = { Unit = { Description = "Noisetorch noise suppression";