Repository navigation
Conversation
|
We don't want to break people's sound when they switch to a new config. This works the same way as most other desktop related things, with the same standard caveats. |
dcbf1ca to
1af8679
Compare
|
I put those behind a new Note that (regardless of this PR), Test package update restarting service
services.pipewire.package = pkgs.pipewire.overrideAttrs {
postFixup = "echo test";
};
reloading user units for gep...
stopping the following user units: pipewire.service, pipewire.socket
reloading the following user units: dbus-broker.service
starting the following user units: pipewire.socket
restarting the following user units: nixos-activation.service
restarting sysinit-reactivation.target
reloading the following units: dbus-broker.service
restarting the following units: systemd-udevd.service
starting the following units: accounts-daemon.service, polkit.service |
Flake lock file updates:
• Added input 'nixpkgs-patch-pipewire-auto-restart':
'NixOS/nixpkgs#549706'
Flake lock file updates:
• Updated input 'gep-dotfiles':
'git+https://git.tchfoo.com/gepbird/dotfiles?ref=refs/heads/main&rev=0ceeb004ce1f20400990104fd76b78d18cc1af35' (2026-08-13)
→ 'git+https://git.tchfoo.com/gepbird/dotfiles?ref=refs/heads/main&rev=6fd88e37317163738bcdff8e06361f97222b5b1e' (2026-08-17)
• Added input 'gep-dotfiles/nixpkgs-patch-pipewire-auto-restart':
'NixOS/nixpkgs#549706'
• Updated input 'gep-dotfiles/nvim-gep':
'git+https://git.tchfoo.com/gepbird/nvim?ref=refs/heads/main&rev=5cd5dafa27f814f6bc5539f9bf7bcb4e41c0e27d' (2026-08-13)
→ 'git+https://git.tchfoo.com/gepbird/nvim?ref=refs/heads/main&rev=882e73700cc73e2bbb930d336d5df9f9d325437c' (2026-08-16)
• Updated input 'gep-dotfiles/nvim-gep/neovim-nightly':
'github:nix-community/neovim-nightly-overlay/3c7255e535760cd414f64af0ebf7715dfd683673' (2026-08-13)
→ 'github:nix-community/neovim-nightly-overlay/3dc8fa3b0b2220ffd0836012407b15aa6747d3fe' (2026-08-16)
• Updated input 'gep-dotfiles/nvim-gep/neovim-nightly/neovim-src':
'github:neovim/neovim/a63393396cd0901050849b72caaa8583949b6ebf' (2026-08-12)
→ 'github:neovim/neovim/2edb1c000958952c87edda596ed9ed53628084ed' (2026-08-15)
• Updated input 'gep-dotfiles/nvim-gep/nixvim':
'github:nix-community/nixvim/738351a7813be094fb00fce1a149bcc25e936c36' (2026-08-12)
→ 'github:nix-community/nixvim/f1311e1d8c101bf3fbce6804de144ca1546d0901' (2026-08-16)
• Updated input 'home-manager':
'github:nix-community/home-manager/0668fdbc15bd602e463cab37ff64346021193652' (2026-08-13)
→ 'github:nix-community/home-manager/353742587cbaf079b3caee743115d037bc51fea6' (2026-08-17)
• Updated input 'nix-index-database':
'github:nix-community/nix-index-database/14d55b8069119e3b88da7aa2f6c97f86a2cd3cd6' (2026-08-09)
→ 'github:nix-community/nix-index-database/c7962dc97b45129df8d751bedaf37beb5a17706e' (2026-08-16)
• Updated input 'nixos-hardware':
'github:NixOS/nixos-hardware/3e7edd9afe17e45521300e041c65de3015f4a302' (2026-08-12)
→ 'github:NixOS/nixos-hardware/ff17823245ab9ff7bcae6acf950bd89cba82c38c' (2026-08-16)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/867dcbc30bafe3c862ef88620f2e7a109d7d3be5' (2026-08-12)
→ 'github:NixOS/nixpkgs/e5bdc4a41d4c072fe1e3787eaa0320a384741d44' (2026-08-16)
• Updated input 'nur':
'github:nix-community/NUR/a5ef785fafbf01c361372d7dc8e0f1591aeeacd3' (2026-08-13)
→ 'github:nix-community/NUR/8be43012c2bacae916ce6ab341257cdd18fa96f0' (2026-08-17)
• Updated input 'sops-nix':
'github:Mic92/sops-nix/d1337e05ba0a8e88a75d2c0e1595d82f3b3e2ac4' (2026-08-10)
→ 'github:Mic92/sops-nix/a8627b21b9107c5711c96b84f32a9a4b3d45295f' (2026-08-13)
• Updated input 'tangled-core':
'git+https://tangled.org/tangled.org/core?ref=refs/heads/master&rev=ad9724b3271a170ee5b0fd81e5e3098303599623' (2026-08-12)
→ 'git+https://tangled.org/tangled.org/core?ref=refs/heads/master&rev=0d028cd5c5cca78937fc17c17418c507fbb6dc0f' (2026-08-17)
• Updated input 'treefmt-nix':
'github:numtide/treefmt-nix/ae7910970dddc408fe6ab1c8e4b277bb21d72dc0' (2026-08-05)
→ 'github:numtide/treefmt-nix/27b3b12a8e6375f28ebe122f07d230ca5459bbfa' (2026-08-16)
ferris-qq
left a comment
There was a problem hiding this comment.
Tested in a NixOS VM (x86_64-linux, nixpkgs e158d9e with this PR's pipewire.nix swapped in through disabledModules). A user with linger = true runs pipewire, pipewire-pulse and wireplumber, and the test switches between specialisations with switch-to-configuration test, checking each unit's InvocationID and the live value with pw-metadata.
| change | restartOnConfigChange = false (default) |
restartOnConfigChange = true |
|---|---|---|
extraConfig.pipewire (default.clock.rate = 44100) |
nothing restarted, clock.rate stays 48000 |
pipewire and pipewire-pulse restarted (wireplumber with them), clock.rate is 44100 |
wireplumber.extraConfig |
only wireplumber restarted, new setting live |
same |
wireplumber.configPackages (a package with only share/wireplumber files) |
only wireplumber restarted |
wireplumber, and also pipewire and pipewire-pulse |
So the option works, and the default stays as it is. Two things I noticed:
-
WirePlumber doesn't need the option.
wireplumber.nixpasses its config throughXDG_DATA_DIRSin the unit's environment (wireplumber.nix#L300-L306), so any change towireplumber.extraConfigorwireplumber.configPackageschangeswireplumber.serviceitself, and the switch already restarts it (stopping the following user units: wireplumber.service, thenstarting). A sentence about that in the option description might save people from looking for a WirePlumber equivalent. -
With the option on, a WirePlumber-only config package also restarts PipeWire. The trigger is
configs, and thatbuildEnvtakeswireplumber.configPackagesas inputs (pipewire.nix#L78-L85) even though it only linksshare/pipewire. Since restarting PipeWire is what interrupts playback, I'd trigger on PipeWire's own inputs instead (suggestion inline). With that,extraConfig.pipewireandservices.pipewire.configPackagesstill restartpipewireandpipewire-pulse(evaluated, and run in the VM forextraConfig), and the WirePlumber-only package restarts onlywireplumber(VM). The trade-off: PipeWire config shipped inside awireplumber.configPackagesentry would no longer restart PipeWire.
systemWide = true was only evaluated, not run: the system units change the same way.
Disclosure: tested and drafted with help from Claude Code (Claude Opus 5.5).
| systemd.services.pipewire.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | ||
| systemd.user.services.pipewire.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | ||
| systemd.services.pipewire-pulse.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | ||
| systemd.user.services.pipewire-pulse.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; |
There was a problem hiding this comment.
Triggering on PipeWire's own config inputs, without wireplumber.configPackages (nixfmt-formatted):
| systemd.services.pipewire.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | |
| systemd.user.services.pipewire.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | |
| systemd.services.pipewire-pulse.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | |
| systemd.user.services.pipewire-pulse.restartTriggers = mkIf cfg.restartOnConfigChange [ configs ]; | |
| systemd.services.pipewire.restartTriggers = mkIf cfg.restartOnConfigChange ( | |
| configPackages ++ [ extraConfigPkg ] | |
| ); | |
| systemd.user.services.pipewire.restartTriggers = mkIf cfg.restartOnConfigChange ( | |
| configPackages ++ [ extraConfigPkg ] | |
| ); | |
| systemd.services.pipewire-pulse.restartTriggers = mkIf cfg.restartOnConfigChange ( | |
| configPackages ++ [ extraConfigPkg ] | |
| ); | |
| systemd.user.services.pipewire-pulse.restartTriggers = mkIf cfg.restartOnConfigChange ( | |
| configPackages ++ [ extraConfigPkg ] | |
| ); |
Flake lock file updates:
• Updated input 'gep-dotfiles/nixpkgs-patch-pipewire-auto-restart':
'NixOS/nixpkgs#549706'
→ follows 'null'
• Updated input 'tangled-core/flake-compat':
'https://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/549f2762aebeff29a2e5ece7a7dc0f955281a1d1.tar.gz?narHash=sha256-NKw96t%2BBgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw%3D&rev=549f2762aebeff29a2e5ece7a7dc0f955281a1d1' (2025-07-05)
→ follows 'null'
• Updated input 'tangled-core/gomod2nix':
'github:nix-community/gomod2nix/02e63a239d6eabd595db56852535992c898eba72' (2025-11-24)
→ follows 'null'
• Removed input 'tangled-core/gomod2nix/flake-utils'
• Removed input 'tangled-core/gomod2nix/flake-utils/systems'
• Removed input 'tangled-core/gomod2nix/nixpkgs'
• Updated input 'tangled-core/hydrant':
'git+https://tangled.org/ptr.pet/hydrant?ref=refs/heads/main&rev=0128352f6b73d26e7ffaa5a79446ef556e452617' (2026-10-21)
→ follows 'null'
• Updated input 'tangled-core/hydrant-dev':
'git+https://tangled.org/ptr.pet/hydrant?ref=refs/heads/main&rev=0128352f6b73d26e7ffaa5a79446ef556e452617' (2026-10-21)
→ follows 'null'
• Updated input 'tangled-core/ibm-plex-mono-src':
'https://github.com/IBM/plex/releases/download/@ibm/[email protected]/ibm-plex-mono.zip?narHash=sha256-OwUmrPfEehLDz0fl2ChYLK8FQM2p0G1%2BEMrGsYEq%2B6g%3D' (2024-11-12)
→ follows 'null'
• Updated input 'tangled-core/indigo':
'github:oppiliappan/indigo/5f170569da9360f57add450a278d73538092d8ca' (2025-07-28)
→ follows 'null'
• Updated input 'tangled-core/microvm':
'github:microvm-nix/microvm.nix/0d49083ba2d7419b22908ac392777c16df9a032e' (2026-05-28)
→ follows 'null'
• Removed input 'tangled-core/microvm/nixpkgs'
• Removed input 'tangled-core/microvm/spectrum'
• Updated input 'tangled-core/nixpkgs-pds':
'github:nixos/nixpkgs/7fd4004d0511991fff3a0524856a9be09e28c5f0' (2026-10-11)
→ follows 'null'
• Updated input 'tangled-core/sqlite-lib-src':
'https://sqlite.org/2024/sqlite-amalgamation-3450100.zip?narHash=sha256-bJoMjirsBjm2Qk9KPiy3yV3%2B8b/POlYe76/FQbciHro%3D' (2024-01-30)
→ follows 'null'
• Updated input 'tangled-core/timeless-fonts-src':
'https://media.timeless.co/type/Timeless-Type-Family-1.094.zip?narHash=sha256-zYpoDkE/YrICzYaHF4/NSuINczFWB41YymTxaL6KqLY%3D' (2026-10-03)
→ follows 'null'
• Updated input 'ymstnt-dotfiles/blip':
'github:blip-net/nix/92ae525425b38b2873d8d52a564a9c146fccba08' (2026-10-27)
→ follows 'null'
• Removed input 'ymstnt-dotfiles/blip/nixpkgs'
Flake lock file updates:
• Updated input 'home-manager':
'github:nix-community/home-manager/a9752a621164e9f84eb2a15858f1d54fd3cedab8' (2026-11-09)
→ 'github:nix-community/home-manager/82ce401aa350502897c3f2e85f384d61cd3b0b6d' (2026-11-10)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/f4a03c008967841f2a0b3cb7c436fc6fc31671f6' (2026-11-07)
→ 'github:NixOS/nixpkgs/177d0540942fb205af6993b1d5fa0b57799e09f8' (2026-11-09)
• Removed input 'nixpkgs-patch-discord-vencord-1-15-16'
• Updated input 'nixpkgs-patch-hytale-launcher':
'NixOS/nixpkgs#479368'
→ 'NixOS/nixpkgs#479368'
• Updated input 'nixpkgs-patch-pipewire-auto-restart':
'NixOS/nixpkgs#549706'
→ 'NixOS/nixpkgs#549706'
• Updated input 'nixpkgs-patch-rustdesk-flutter-fix-build':
'NixOS/nixpkgs#585583'
→ 'NixOS/nixpkgs#585583'
• Updated input 'nur':
'github:nix-community/NUR/d5b727db34219332642086dba98e08f371d31c5e' (2026-11-10)
→ 'github:nix-community/NUR/7b921c747644347cbb458826f751416c2a7d96d3' (2026-11-12)
Flake lock file updates:
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/177d0540942fb205af6993b1d5fa0b57799e09f8' (2026-11-09)
→ 'github:NixOS/nixpkgs/d4f25a3e562008648d45bcf2d70bcc7422cad84e' (2026-11-11)
• Updated input 'nixpkgs-patch-hytale-launcher':
'NixOS/nixpkgs#479368'
→ 'NixOS/nixpkgs#479368'
• Updated input 'nixpkgs-patch-pipewire-auto-restart':
'NixOS/nixpkgs#549706'
→ 'NixOS/nixpkgs#549706'
• Removed input 'nixpkgs-patch-rustdesk-flutter-fix-build'
• Updated input 'nur':
'github:nix-community/NUR/7b921c747644347cbb458826f751416c2a7d96d3' (2026-11-12)
→ 'github:nix-community/NUR/655f5e9ff6a3705fb0252445b3d4b29efc4bfea0' (2026-11-12)
Flake lock file updates:
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/04906337b6d53e8bb0eaf0470ae9f070a4d4eb55' (2026-11-17)
→ 'github:NixOS/nixpkgs/0bb8272318b4ca41bf0edc6224df3e3e3046b70d' (2026-11-19)
• Updated input 'nixpkgs-patch-hytale-launcher':
'NixOS/nixpkgs#479368'
→ 'NixOS/nixpkgs#479368'
• Removed input 'nixpkgs-patch-openasar-fix-videos-and-gifs-not-playing'
• Updated input 'nixpkgs-patch-pipewire-auto-restart':
'NixOS/nixpkgs#549706'
→ 'NixOS/nixpkgs#549706'
• Removed input 'nixpkgs-patch-rom-0-6-1'
• Updated input 'nur':
'github:nix-community/NUR/68c0a7bac471d7250057557c7c722f69cc28a976' (2026-11-18)
→ 'github:nix-community/NUR/97d4d8f1cd0131576043b02f644d404b1789aa28' (2026-11-20)
• Updated input 'treefmt-nix':
'github:numtide/treefmt-nix/0d6d739a833ba9a9c93034862e4a7b061a062a1c' (2026-10-13)
→ 'github:numtide/treefmt-nix/a0a97e31a897a3537eea5c49df4f8adaa83b3b37' (2026-11-20)
Previously after changing some pipewire configuration and switching to the new system config, the new pipewire config didn't get loaded and the user had to manually restart the service (after figuring out that their config was not applied by the module automatically).
Reproduce the problem
pw-cli info 0 | grep default.clock.rate-> 48000pw-cli info 0 | grep default.clock.rate-> 48000systemctl --user restart pipewire.servicepw-cli info 0 | grep default.clock.rate-> 44100I've seen socket activation + proper config reload needing
stopIfChanged = false, but I'm not exactly sure why yet. Sometimes the new config applies without it, sometimes it doesn't.The core behaviour matches the docs, where with
stopIfChanged = false,switch-to-configurationsays that thepipewire.serviceandpipewire.socketis being restarted, withstopIfChanged = trueit says that these 2 are being stopped andpipewire.socketis being started, except the service logs don't mention any events for the latter.Related issue which I only glanced at before sleep: #74899
I can imagine that config (and package?) changes were intentionally not restarting the services to avoid breaking apps (e.g. by manually restarting pipewire and pipewire-pulse while a video was playing in a browser, I had to reload the page to get audio working again), I wonder if we'd get mass reports that music/videos stopped playing after a system update's switch-to-configuration, and in worse cases a full app restart is needed.
If this was the intention, I recommend we document it instead in the options' descriptions, and put the reload functionality behind a new option.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.