Flake for my NixOS devices

Add Musnix

bwc9876.dev 6b588cb8 10e97d77

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