1

use mkEnableOpt instead of mkBoolOpt

This commit is contained in:
2022-08-10 12:56:47 +02:00
parent d437f67a26
commit 33dc750d4c
4 changed files with 26 additions and 22 deletions

View File

@ -9,6 +9,9 @@ rec {
description = desc; description = desc;
}; };
# Alias for consistency
mkEnableOpt = lib.mkEnableOption;
# Like mkIf but the predicate is inverted # Like mkIf but the predicate is inverted
mkElse = pred: do: mkElse = pred: do:
(lib.mkIf (!pred) do); (lib.mkIf (!pred) do);

View File

@ -12,25 +12,25 @@ in {
]; ];
options.modules.audio = { 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: Group these in categories (like instruments/VSTs or sth)
# TODO: Make it easier to add many yes/no options, similar to the flatpak stuff # TODO: Make it easier to add many yes/no options, similar to the flatpak stuff
# Hosts/Editing # Hosts/Editing
carla.enable = mkBoolOpt false "Enable Carla + guitar-specific stuff"; carla.enable = mkEnableOpt "Carla (VST host)";
bitwig.enable = mkBoolOpt false "Enable Bitwig Studio digital audio workstation"; bitwig.enable = mkEnableOpt "Bitwig (Digital audio workstation)";
tenacity.enable = mkBoolOpt false "Enable Tenacity"; tenacity.enable = mkEnableOpt "Tenacity (Audacity fork)";
# Instruments/Plugins # Instruments/Plugins
vcvrack.enable = mkBoolOpt false "Enable the VCV-Rack Eurorack simulator"; vcvrack.enable = mkEnableOpt "VCV-Rack (Eurorack simulator)";
vital.enable = mkBoolOpt false "Enable the Vital wavetable Synthesizer"; vital.enable = mkEnableOpt "Vital (Wavetable synthesizer)";
# Misc # Misc
faust.enable = mkBoolOpt false "Enable the Faust functional DSP language"; faust.enable = mkEnableOpt "Faust (functional DSP language)";
bottles.enable = mkBoolOpt false "Enable Bottles to emulate windows VSTs (flatpak)"; bottles.enable = mkEnableOpt "Bottles (flatpak)";
yabridge = { yabridge = {
enable = mkBoolOpt false "Enable yabridge + yabridgectl"; enable = mkEnableOpt "Yabridge (Windows VST plugin manager)";
autoSync = mkBoolOpt false "Sync yabridge plugins on nixos-rebuild"; autoSync = mkBoolOpt false "Sync yabridge plugins on nixos-rebuild";
}; };
}; };
@ -123,7 +123,7 @@ in {
(mkUnlink "${config.home.homeDirectory}/.vst3/Vital.vst3"); (mkUnlink "${config.home.homeDirectory}/.vst3/Vital.vst3");
}) })
(mkIf cfg.yabridge.autoSync { (mkIf (cfg.yabridge.enable && cfg.yabridge.autoSync) {
syncYabridge = hm.dag.entryAfter [ "writeBoundary" ] '' syncYabridge = hm.dag.entryAfter [ "writeBoundary" ] ''
yabridgectl sync yabridgectl sync
''; '';

View File

@ -15,7 +15,7 @@ in {
imports = [ ]; imports = [ ];
options.modules.flatpak = { 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"; 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"; iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them";
autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild"; autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild";
@ -24,10 +24,10 @@ in {
# TODO: Add library function to make this easier # 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: The flatpak name should be included and a list of all enabled apps should be available
# TODO: Do this for strings + packages # TODO: Do this for strings + packages
discord.enable = mkBoolOpt false "Enable Discord"; discord.enable = mkEnableOpt "Discord";
spotify.enable = mkBoolOpt false "Enable Spotify"; spotify.enable = mkEnableOpt "Spotify";
flatseal.enable = mkBoolOpt true "Enable Flatseal"; flatseal.enable = mkEnableOpt "Flatseal";
bottles.enable = mkBoolOpt false "Enable Bottles"; bottles.enable = mkEnableOpt "Bottles";
# This is mainly used by other modules to allow them to use flatpak packages # This is mainly used by other modules to allow them to use flatpak packages
extraInstall = mkOption { extraInstall = mkOption {

View File

@ -13,18 +13,19 @@ in {
]; ];
options.modules.gaming = { options.modules.gaming = {
enable = mkBoolOpt false "Enable the Gaming module"; enable = mkEnableOpt "Gaming module";
discordChromium.enable = mkBoolOpt false "Enable Discord as Chromium webapp";
polymc.enable = mkBoolOpt false "Enable PolyMC for Minecraft (flatpak)"; discordChromium.enable = mkEnableOpt "Discord (Chromium)";
bottles.enable = mkBoolOpt false "Enable Bottles to emulate Windows games (flatpak)"; polymc.enable = mkEnableOpt "PolyMC (flatpak)";
bottles.enable = mkEnableOpt "Bottles (flatpak)";
noisetorch = { noisetorch = {
enable = mkBoolOpt false "Enable Noisetorch"; enable = mkEnableOpt "Noisetorch";
autostart = mkBoolOpt false "Autostart Noistorch"; autostart = mkBoolOpt false "Autostart Noistorch";
}; };
steam = { steam = {
enable = mkBoolOpt false "Enable steam (flatpak)"; enable = mkEnableOpt "Steam (flatpak)";
protonGE = mkBoolOpt false "Enable Steam Proton GloriousEggroll runner (flatpak)"; protonGE = mkBoolOpt false "Enable Steam Proton GloriousEggroll runner (flatpak)";
gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)"; gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)";
}; };
@ -63,7 +64,7 @@ in {
categories = [ "Network" "Chat" ]; categories = [ "Network" "Chat" ];
}; };
systemd.user.services = mkIf cfg.noisetorch.autostart { systemd.user.services = mkIf (cfg.noisetorch.enable && cfg.noisetorch.autostart) {
noisetorch-autostart = { noisetorch-autostart = {
Unit = { Unit = {
Description = "Noisetorch noise suppression"; Description = "Noisetorch noise suppression";