All Projects → musnix → Musnix

musnix / Musnix

Licence: bsd-3-clause
Real-time audio in NixOS

Labels

Projects that are alternatives of or similar to Musnix

Nixos Weekly
NixOS Weekly Newsletter
Stars: ✭ 137 (-20.81%)
Mutual labels:  nix
Robotnix
Build Android (AOSP) using Nix
Stars: ✭ 149 (-13.87%)
Mutual labels:  nix
Ihp
🔥 The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness
Stars: ✭ 2,746 (+1487.28%)
Mutual labels:  nix
Vim Nix
Vim configuration files for Nix http://nixos.org/nix
Stars: ✭ 138 (-20.23%)
Mutual labels:  nix
Miso
🍜 A tasty Haskell front-end framework
Stars: ✭ 1,911 (+1004.62%)
Mutual labels:  nix
Nixos Shell
Spawns lightweight nixos vms in a shell
Stars: ✭ 152 (-12.14%)
Mutual labels:  nix
Install Nix Action
Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.
Stars: ✭ 132 (-23.7%)
Mutual labels:  nix
Nixpkgs Fmt
Nix code formatter for nixpkgs [[email protected]]
Stars: ✭ 171 (-1.16%)
Mutual labels:  nix
Dotfiles
~ 🍭 ~
Stars: ✭ 147 (-15.03%)
Mutual labels:  nix
Home Manager
Manage a user environment using Nix [maintainer=@rycee]
Stars: ✭ 2,447 (+1314.45%)
Mutual labels:  nix
Shabka
Shabka. Declaritive description of my network, workstations and servers.
Stars: ✭ 138 (-20.23%)
Mutual labels:  nix
Appvm
Nix-based app VMs
Stars: ✭ 146 (-15.61%)
Mutual labels:  nix
Nix On Droid
Nix-enabled environment for your Android device.
Stars: ✭ 154 (-10.98%)
Mutual labels:  nix
Nix Mode
An Emacs major mode for editing Nix expressions.
Stars: ✭ 137 (-20.81%)
Mutual labels:  nix
Vulnix
Vulnerability (CVE) scanner for Nix/NixOS.
Stars: ✭ 161 (-6.94%)
Mutual labels:  nix
Nix Files
My NixOS configuration and custom Nix derivations.
Stars: ✭ 136 (-21.39%)
Mutual labels:  nix
Dotfiles
My dotfiles
Stars: ✭ 150 (-13.29%)
Mutual labels:  nix
Nixos Mailserver
A complete and Simple Nixos Mailserver
Stars: ✭ 172 (-0.58%)
Mutual labels:  nix
Deploy Rs
A simple multi-profile Nix-flake deploy tool.
Stars: ✭ 164 (-5.2%)
Mutual labels:  nix
Nix Bitcoin
A collection of Nix packages and NixOS modules for easily installing full-featured Bitcoin nodes with an emphasis on security.
Stars: ✭ 154 (-10.98%)
Mutual labels:  nix

musnix

Real-time audio in NixOS

About

musnix provides a set of simple, high-level configuration options for doing real-time audio work in NixOS, including optimizing the kernel, applying the CONFIG_PREEMPT_RT patch to it, and adjusting various low-level system settings.

Basic Usage

Clone this project.

Add the following to your configuration.nix:

{
  imports =
    [ # ...
      /path/to/musnix/clone
    ];

  musnix.enable = true;
  users.users.johndoe.extraGroups = [ "audio" ];
}

To update musnix, run git pull.

Later sections of this document contain information about the various configuration options.

Using musnix as a channel

As an alternative to the above approach, you can instead add musnix as a channel:

sudo -i nix-channel --add https://github.com/musnix/musnix/archive/master.tar.gz musnix
sudo -i nix-channel --update musnix

Add <musnix> to imports in your configuration.nix:

{
  imports =
    [ # ...
      <musnix>
    ];

  musnix.enable = true;
  users.users.johndoe.extraGroups = [ "audio" ];
}

To update musnix, run:

sudo -i nix-channel --update musnix

Base Options

musnix.enable

  • Description: Enable musnix, a module for real-time audio.

  • Type: boolean

  • Default value: false

  • NOTE: This option must be set to true to use other musnix base options.

  • Details: If enabled, this option will do the following:

    • Activate the performance CPU frequency scaling governor.

    • Set vm.swappiness to 10.

    • Set the following udev rules:

      KERNEL=="rtc0", GROUP="audio"
      KERNEL=="hpet", GROUP="audio"
      
    • Set the max_user_freq of /sys/class/rtc/rtc0 to 2048.

    • Set the max-user-freq of /proc/sys/dev/hpet to 2048.

    • Set the following PAM limits:

      @audio  -       memlock unlimited
      @audio  -       rtprio  99
      @audio  soft    nofile  99999
      @audio  hard    nofile  99999
      
    • Set the following environment variables to default install locations in NixOS:

      • VST_PATH
      • LVST_PATH
      • LADSPA_PATH
      • LV2_PATH
      • DSSI_PATH
    • Allow users to install plugins in the following directories:

      • ~/.vst
      • ~/.lvst
      • ~/.ladspa
      • ~/.lv2
      • ~/.dssi

musnix.alsaSeq.enable

  • Description: If enabled, load ALSA Sequencer kernel modules. Currently, this only loads the snd_seq and snd_rawmidi modules.
  • Type: boolean
  • Default value: true

musnix.ffado.enable

  • Description: If enabled, use the Free FireWire Audio Drivers (FFADO).
  • Type: boolean
  • Default value: false

musnix.soundcardPciId

  • Description: The PCI ID of the primary soundcard. Used to set the PCI latency timer.

    To find the PCI ID of your soundcard:

    lspci | grep -i audio
    
  • Type: string

  • Default value: ""

  • Example value: "00:1b.0"

Kernel Options

NOTE: The following kernel options can be used without setting musnix.enable = true;

musnix.kernel.optimize

  • NOTE: Enabling this option will rebuild your kernel.
  • Description: If enabled, this option will configure the kernel to be preemptible, to use the deadline I/O scheduler, and to use the High Precision Event Timer (HPET).
  • Type: boolean
  • Default value: false

musnix.kernel.realtime

  • NOTE: Enabling this option will rebuild your kernel.
  • Description: If enabled, this option will apply the CONFIG_PREEMPT_RT patch to the kernel.
  • Type: boolean
  • Default value: false

musnix.kernel.packages

  • Description: This option allows you to select the real-time kernel used by musnix.

  • Type: package

  • Default value: `pkgs.linuxPackages_5_4_rt, which is the major version that NixPkgs unstable currently uses.

  • Available packages:

    • pkgs.linuxPackages_3_18_rt
    • pkgs.linuxPackages_4_1_rt
    • pkgs.linuxPackages_4_4_rt
    • pkgs.linuxPackages_4_9_rt
    • pkgs.linuxPackages_4_11_rt
    • pkgs.linuxPackages_4_13_rt
    • pkgs.linuxPackages_4_14_rt
    • pkgs.linuxPackages_4_16_rt
    • pkgs.linuxPackages_4_18_rt
    • pkgs.linuxPackages_4_19_rt
    • pkgs.linuxPackages_5_0_rt
    • pkgs.linuxPackages_5_4_rt
    • pkgs.linuxPackages_5_6_rt

    or:

    • pkgs.linuxPackages_latest_rt (currently pkgs.linuxPackages_5_6_rt)

musnix.kernel.latencytop

  • NOTE: Enabling this option will rebuild your kernel.
  • NOTE: This option is only intended to be used for diagnostic purposes, and may cause other issues.
  • Description: If enabled, this option will configure the kernel to use a latency tracking infrastructure that is used by the "latencytop" userspace tool.
  • Type: boolean
  • Default value: false

rtirq Options

NOTES:

  • The following rtirq options can be used without setting musnix.enable = true;
  • musnix.kernel.realtime must be set to true to use these options.

musnix can also install and run the rtirq script as a systemd service.

To see a list of options for using this feature, use the following command:

nixos-option musnix.rtirq

To see a description of one of the listed options (in this case enable):

nixos-option musnix.rtirq.enable

Other Options

musnix.das_watchdog.enable

  • Description: If enabled, start the das_watchdog service. This service will ensure that a realtime process won't hang the machine.
  • Type: boolean
  • Default value: true if musnix.kernel.realtime.enable = true, otherwise false

Communication

More Information

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].