summaryrefslogtreecommitdiffstats
path: root/usecases/desktop/graphical/audio-production.nix
blob: 95345d62f79ebc20e9b8e987d6e4771dec05d78c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
inputs:
{ pkgs, lib, ... }:
{
  imports = [ "${inputs.musnix}" ];

  musnix.enable = true;

  users.extraUsers.minijackson = {
    packages = with pkgs.unstable; [
      latencytop

      # helvum

      ardour
      bespokesynth
      cardinal
      fluidsynth
      giada
      hydrogen
      lmms
      musescore
      qjackctl
      qsampler
      qsynth
      show-midi
      soundfont-fluid

      # plugins
      aeolus
      talentedhack
      CHOWTapeModel
      aether-lv2
      airwindows-lv2
      calf
      carla
      # distrho
      drumgizmo
      # fmsynth
      guitarix
      # helm
      # infamousPlugins
      LibreArp
      lsp-plugins
      ninjas2
      noise-repellent
      odin2
      surge-XT
      sfizz
      wolf-shaper
      x42-avldrums
      x42-gmsynth
      x42-plugins
      # yabridge
      # yabridgectl
      yoshimi
      zynaddsubfx

      # Soundfonts
      soundfont-ydp-grand
      soundfont-fluid
    ];
    extraGroups = [ "audio" ];
  };

  environment.pathsToLink = [ "/share/soundfonts" ];

  # TODO: upstream adding user-specific packages
  environment.variables = {
    DSSI_PATH = lib.mkForce "$HOME/.dssi:$HOME/.nix-profile/lib/dssi:/run/current-system/sw/lib/dssi:/etc/profiles/per-user/$USER/lib/dssi";
    LADSPA_PATH = lib.mkForce "$HOME/.ladspa:$HOME/.nix-profile/lib/ladspa:/run/current-system/sw/lib/ladspa:/etc/profiles/per-user/$USER/lib/ladspa";
    LV2_PATH = lib.mkForce "$HOME/.lv2:$HOME/.nix-profile/lib/lv2:/run/current-system/sw/lib/lv2:/etc/profiles/per-user/$USER/lib/lv2";
    LXVST_PATH = lib.mkForce "$HOME/.lxvst:$HOME/.nix-profile/lib/lxvst:/run/current-system/sw/lib/lxvst:/etc/profiles/per-user/$USER/lib/lxvst";
    VST_PATH = lib.mkForce "$HOME/.vst:$HOME/.nix-profile/lib/vst:/run/current-system/sw/lib/vst:/etc/profiles/per-user/$USER/lib/vst";
    VST3_PATH = lib.mkForce "$HOME/.vst3:$HOME/.nix-profile/lib/vst3:/run/current-system/sw/lib/vst3:/etc/profiles/per-user/$USER/lib/vst3";
  };

  # https://wiki.nixos.org/wiki/PipeWire#Low-latency_setup
  services.pipewire.extraConfig = {
    pipewire."92-low-latency" = {
      "context.properties" = {
        "default.clock.rate" = 48000;
        "default.clock.quantum" = 128;
        "default.clock.min-quantum" = 128;
        "default.clock.max-quantum" = 128;
      };
    };

    pipewire-pulse."92-low-latency" = {
      "context.properties" = [
        {
          name = "libpipewire-module-protocol-pulse";
          args = { };
        }
      ];
      "pulse.properties" = {
        "pulse.min.req" = "128/48000";
        "pulse.default.req" = "128/48000";
        "pulse.max.req" = "128/48000";
        "pulse.min.quantum" = "128/48000";
        "pulse.max.quantum" = "128/48000";
      };
      "stream.properties" = {
        "node.latency" = "128/48000";
        "resample.quality" = 1;
      };
    };
  };
}