1

add audio module

This commit is contained in:
2022-08-07 18:42:28 +02:00
parent fe7cb58ac7
commit 3726ba4f11
2 changed files with 96 additions and 27 deletions

View File

@ -11,26 +11,29 @@ rec {
# Feel free to split up your configuration and import pieces of it here.
./modules/emacs.nix
./modules/audio.nix
# inputs.nixvim.homeManagerModules.nixvim
];
# Config my modules
modules = {
emacs.enable = true;
emacs.useDoom = true;
emacs.autosync = true;
modules.emacs = {
enable = true;
useDoom = true;
autosync = true;
};
modules.audio = {
enable = true;
carla = true;
yabridge.enable = true;
yabridge.autosync = true;
};
# TODO: Email
# TODO: Run noisetorch as login script
# TODO: Gnome terminal config
# TODO: Update flatpak on rebuild? Make a setting/module for this, emacs update and yabridgectl update... Use home.activation...
home.activation.syncYabridge = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
yabridgectl sync
'';
# Disabled since HomeManager should use global pkgs
# https://github.com/nix-community/home-manager/issues/2942
# nixpkgs.config.allowUnfreePredicate = (pkg: true);
@ -49,6 +52,8 @@ rec {
# NOTE: I don't think I need this anymore as all fonts are installed through the system config but let's keep this just in case
fonts.fontconfig.enable = true; # Also updates the font-cache
# TODO: Add to flatpak module
# TODO: Update flatpak on rebuild?
# We link like this to be able to address the absolute location, also the fonts won't get copied to store
# NOTE: This path contains all the fonts because fonts.fontDir.enable is true
home.activation.linkFontDir = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
@ -63,7 +68,6 @@ rec {
ln -sf /etc/profiles/per-user/christoph/share/icons ${home.homeDirectory}/.local/share/icons
fi
'';
# Allow access to linked fonts/icons
home.file.".local/share/flatpak/overrides/global".text = ''
[Context]
@ -89,19 +93,7 @@ rec {
in
formatted;
# TODO: Music module
# NOTE: This desktop entry is created in /etc/profiles/per-user/christoph/share/applications
# This location is part of XDG_DATA_DIRS
xdg.desktopEntries.guitar = {
name = "Guitar Amp (Carla)";
genericName = "Guitar Amp Simulation";
icon = "carla";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${home.homeDirectory}/Documents/Carla/GuitarDefault.carxp";
terminal = false;
categories = [ "Music" "Audio" ];
};
# TODO: Does this has to be set manually or is it set by flatpak.enable?
# NOTE: Is set by flatpak.enable
# xdg.systemDirs.data = [
# "/var/lib/flatpak/exports/share"
# "${home.homeDirectory}/.local/share/flatpak/exports/share"
@ -273,13 +265,12 @@ rec {
# godot
# Audio
# TODO: Make a module, autosync yabridge on rebuild?
# vcv-rack
bitwig-studio
# audacity
carla
yabridge
yabridgectl
# Module carla
# Module yabridge
# Module yabridgectl
# Use NixCommunity binary cache
cachix

78
home/modules/audio.nix Normal file
View File

@ -0,0 +1,78 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.audio;
in {
imports = [ ];
options.modules.audio = {
enable = mkOption {
type = types.bool;
default = false;
description = "Configure for realtime audio and enable a bunch of music production tools";
};
carla = mkOption {
type = types.bool;
default = false;
description = "Enable Carla + guitar-specific stuff";
};
yabridge = {
enable = {
type = types.bool;
default = false;
description = "Enable yabridge + yabridgectl";
};
autosync = {
type = types.bool;
default = false;
description = "Sync yabridge plugins on nixos-rebuild";
};
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; (mkMerge [
(mkIf cfg.carla [ carla ])
(mkIf cfg.yabridge.enable [ yabridge yabridgectl ])
]);
# NOTE: This desktop entry is created in /etc/profiles/per-user/christoph/share/applications
# This location is part of XDG_DATA_DIRS
xdg.desktopEntries.guitar = mkIf cfg.carla {
name = "Guitar Amp (Carla)";
genericName = "Guitar Amp Simulation";
icon = "carla";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${home.homeDirectory}/.config/carla/GuitarDefault.carxp";
terminal = false;
categories = [ "Music" "Audio" ];
};
home.activation = (mkMerge [
(mkIf cfg.carla {
# The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira
# TODO: I don't know if I should keep this
linkCarlaConfig = hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -L "${config.home.homeDirectory}/.config/carla" ]; then
ln -sf ${config.home.homeDirectory}/NixFlake/config/carla ${config.home.homeDirectory}/.config/carla
fi
'';
})
(mkIf cfg.yabridge.autosync {
syncYabridge = hm.dag.entryAfter [ "writeBoundary" ] ''
yabridgectl sync
'';
})
]);
};
}