Flake for my NixOS devices

Add Musnix

bwc9876.dev 6b588cb8 10e97d77

verified
+85 -29
+36 -15
flake.lock
··· 401 401 ] 402 402 }, 403 403 "locked": { 404 - "lastModified": 1767811801, 405 - "narHash": "sha256-QICeGwbXfqtaOZmgh6BrSBB72drPuHO3pjuyh+x8eIY=", 404 + "lastModified": 1767893475, 405 + "narHash": "sha256-yNpAuNVCDcR299BKjaT5PuoJclEBukmC5nj3L98UE3E=", 406 406 "owner": "nix-community", 407 407 "repo": "home-manager", 408 - "rev": "c068188a8e5c277f7bc8671557a7568864b57515", 408 + "rev": "3351348827926935b407d1cfbb7dd814c30da107", 409 409 "type": "github" 410 410 }, 411 411 "original": { ··· 424 424 ] 425 425 }, 426 426 "locked": { 427 - "lastModified": 1767821675, 428 - "narHash": "sha256-hYdVQBFd0uTDkMEJiBvL+zFq4YfWzwSqA+xBU+7hs00=", 427 + "lastModified": 1767822991, 428 + "narHash": "sha256-iyrn9AcPZCoyxX4OT8eMkBsjG7SRUQXXS/V1JzxS7rA=", 429 429 "owner": "nix-community", 430 430 "repo": "impermanence", 431 - "rev": "a3145896887dffa055e321876f376937da78cd97", 431 + "rev": "82e5bc4508cab9e8d5a136626276eb5bbce5e9c5", 432 432 "type": "github" 433 433 }, 434 434 "original": { ··· 476 476 "type": "github" 477 477 } 478 478 }, 479 + "musnix": { 480 + "inputs": { 481 + "nixpkgs": [ 482 + "nixpkgs" 483 + ] 484 + }, 485 + "locked": { 486 + "lastModified": 1767232402, 487 + "narHash": "sha256-li+h6crnhc5Zqs+M6pn7D7M0W9M63ECNennDjRgzioE=", 488 + "owner": "musnix", 489 + "repo": "musnix", 490 + "rev": "d65f98e0b1f792365f1705653d7b2d266ceeff6e", 491 + "type": "github" 492 + }, 493 + "original": { 494 + "owner": "musnix", 495 + "repo": "musnix", 496 + "type": "github" 497 + } 498 + }, 479 499 "niri": { 480 500 "inputs": { 481 501 "niri-stable": "niri-stable", ··· 488 508 "xwayland-satellite-unstable": "xwayland-satellite-unstable" 489 509 }, 490 510 "locked": { 491 - "lastModified": 1767817997, 492 - "narHash": "sha256-JfW20UCz5MdxLKsvI2+2RsbDXBd0Fa8x9yn2MCqq+DI=", 511 + "lastModified": 1767833217, 512 + "narHash": "sha256-HLr9k8g1Geq40PLsNw7I5N8TZkBYtQVjkgDPV/Kehxk=", 493 513 "owner": "sodiboo", 494 514 "repo": "niri-flake", 495 - "rev": "e922ff82a8fb5d92c292d460e4bd89935e2a7e17", 515 + "rev": "a789aa1512a9157d5d3392b27e60621fd0d83438", 496 516 "type": "github" 497 517 }, 498 518 "original": { ··· 587 607 }, 588 608 "nixpkgs-stable": { 589 609 "locked": { 590 - "lastModified": 1767634882, 591 - "narHash": "sha256-2GffSfQxe3sedHzK+sTKlYo/NTIAGzbFCIsNMUPAAnk=", 610 + "lastModified": 1767799921, 611 + "narHash": "sha256-r4GVX+FToWVE2My8VVZH4V0pTIpnu2ZE8/Z4uxGEMBE=", 592 612 "owner": "NixOS", 593 613 "repo": "nixpkgs", 594 - "rev": "3c9db02515ef1d9b6b709fc60ba9a540957f661c", 614 + "rev": "d351d0653aeb7877273920cd3e823994e7579b0b", 595 615 "type": "github" 596 616 }, 597 617 "original": { ··· 760 780 "hm": "hm", 761 781 "imperm": "imperm", 762 782 "lanzaboote": "lanzaboote", 783 + "musnix": "musnix", 763 784 "niri": "niri", 764 785 "nix-index-db": "nix-index-db", 765 786 "nixos-hardware": "nixos-hardware", ··· 974 995 "xwayland-satellite-unstable": { 975 996 "flake": false, 976 997 "locked": { 977 - "lastModified": 1766429945, 978 - "narHash": "sha256-9Kv4gWagx/u4RfZJzBMAoagW9ava5waxd+XoTkzqF7E=", 998 + "lastModified": 1767830382, 999 + "narHash": "sha256-0PgS7M1SV6JCN3MugFZPaP8J+Mr2o7lSDFTPVYZSIAY=", 979 1000 "owner": "Supreeeme", 980 1001 "repo": "xwayland-satellite", 981 - "rev": "0dde7ca1d3a8e8c5082533d76084e2aa02bef70e", 1002 + "rev": "74cf1a95a35fd7aec76432bc2cd9b310e0d908c5", 982 1003 "type": "github" 983 1004 }, 984 1005 "original": {
+5 -2
flake.nix
··· 21 21 nixvim.url = "github:nix-community/nixvim"; 22 22 nixvim.inputs.nixpkgs.follows = "nixpkgs"; 23 23 imperm.url = "github:nix-community/impermanence"; 24 - imperm.inputs.nixpkgs.follows = "nixpkgs"; 25 - imperm.inputs.home-manager.follows = "hm"; 24 + imperm.inputs.nixpkgs.follows = "nixpkgs"; 25 + imperm.inputs.home-manager.follows = "hm"; 26 26 nu_plugin_dbus.url = "github:Bwc9876/nu_plugin_dbus"; 27 27 nu_plugin_dbus.inputs.nixpkgs.follows = "nixpkgs"; 28 28 gh-grader-preview.url = "github:Bwc9876/gh-grader-preview"; ··· 31 31 bingus.inputs.nixpkgs.follows = "nixpkgs"; 32 32 niri.url = "github:sodiboo/niri-flake"; 33 33 niri.inputs.nixpkgs.follows = "nixpkgs"; 34 + musnix.url = "github:musnix/musnix"; 35 + musnix.inputs.nixpkgs.follows = "nixpkgs"; 34 36 35 37 spoon.url = "git+https://codeberg.org/spoonbaker/mono"; 36 38 spoon.inputs = { ··· 59 61 spoon, 60 62 gh-grader-preview, 61 63 niri, 64 + musnix, 62 65 }: 63 66 flakelight ./. { 64 67 imports = [
+5
nixosConfigurations/aperture.nix
··· 44 44 ]; 45 45 46 46 cow = { 47 + audio.tweaks = { 48 + enable = true; 49 + threadirqs = true; 50 + soundCard = "00:1f.3"; 51 + }; 47 52 base.sysrqs = true; 48 53 bean.sudoer = true; 49 54 lanzaboote.enable = true;
+38 -11
nixosModules/audio.nix
··· 1 - {...}: { 1 + {inputs, ...}: { 2 2 config, 3 3 lib, 4 4 ... 5 5 }: { 6 - options.cow.audio.enable = lib.mkEnableOption "audo config with Pipewire"; 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 + }; 7 34 8 - config = lib.mkIf config.cow.audio.enable { 9 - services.pulseaudio.enable = false; 10 - security.rtkit.enable = true; # Allows pipewire and friends to run realtime 11 - services.pipewire = { 12 - enable = true; 13 - pulse.enable = true; 14 - alsa = { 35 + musnix = lib.mkIf conf.tweaks.enable { 15 36 enable = true; 16 - support32Bit = 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"]; 17 45 }; 18 46 }; 19 - }; 20 47 }
+1 -1
nixosModules/base.nix
··· 82 82 (lib.mkIf conf.boot { 83 83 boot = { 84 84 initrd.systemd.enable = lib.mkDefault true; 85 - kernelParams = lib.mkDefault ["lockdown=confidentiality"]; 85 + kernelParams = ["lockdown=confidentiality"]; 86 86 }; 87 87 }) 88 88 (lib.mkIf conf.linux-latest {