Flake for my NixOS devices
at musnix 47 lines 1.2 kB view raw
1{inputs, ...}: { 2 config, 3 lib, 4 ... 5}: { 6 imports = [inputs.musnix.nixosModules.musnix]; 7 8 options.cow.audio = { 9 enable = lib.mkEnableOption "audio config with Pipewire"; 10 tweaks = { 11 enable = lib.mkEnableOption "audio performance tweaks with musnix"; 12 threadirqs = lib.mkEnableOption "threadirqs kernel param"; 13 soundCard = lib.mkOption { 14 type = lib.types.nullOr lib.types.str; 15 description = "PCI ID of the primary soundcard (lspci | grep -i audio)"; 16 default = null; 17 }; 18 }; 19 }; 20 21 config = let 22 conf = config.cow.audio; 23 in 24 lib.mkIf conf.enable { 25 services.pulseaudio.enable = false; 26 services.pipewire = { 27 enable = true; 28 pulse.enable = true; 29 alsa = { 30 enable = true; 31 support32Bit = true; 32 }; 33 }; 34 35 musnix = lib.mkIf conf.tweaks.enable { 36 enable = true; 37 rtcqs.enable = true; 38 soundcardPciId = lib.mkIf (conf.tweaks.soundCard != null) conf.tweaks.soundCard; 39 }; 40 41 boot.kernelParams = lib.mkIf (conf.tweaks.threadirqs) ["threadirqs"]; 42 43 users.users = lib.mkIf config.cow.bean.enable { 44 bean.extraGroups = ["audio"]; 45 }; 46 }; 47}