Skip to content

feat(wrapperModules.niri): hot reload with new config after build#496

Merged
BirdeeHub merged 1 commit into
BirdeeHub:mainfrom
iynaix:niri-reload-config
May 3, 2026
Merged

feat(wrapperModules.niri): hot reload with new config after build#496
BirdeeHub merged 1 commit into
BirdeeHub:mainfrom
iynaix:niri-reload-config

Conversation

@iynaix
Copy link
Copy Markdown
Contributor

@iynaix iynaix commented May 3, 2026

Hot reloads niri with the new config after building, based on the conversation from: Lassulus/wrappers#135

It currently hot reloads by default, since I think it's probably the behavior most people want / expect.

@BirdeeHub
Copy link
Copy Markdown
Owner

Yes looks good.

Thanks for this! I need to learn more about these reload if changed triggers

When we get services options it might be really helpful with dealing with copying impure files for things that need writable config directories

[Unit]
X-Reload-Triggers=${config.constructFiles.generatedConfig.path}
[Service]
ExecReload=${lib.getExe config.package} msg action load-config-file --path ${config.constructFiles.generatedConfig.path}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually hang on.

Question.

How does this work.

Wouldn't the service that is registered be the old one, which would have the old path?

It seems like they were doing it the same way there too but I would still like to understand what I am missing here.

Is it that since you have it specifically installed via nixos or home manager, the service gets updated, but it doesn't know that it needs to reload without this trigger, but when it reloads it reloads the new service instead of the current one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I think happens (I'm no expert) is that the service file changes, systemd sees that the value of X-Reload-Triggers has changed, and runs ExecReload.

I did try doing it directly in buildPhase but it doesn't work in the nix build sandbox, complains about NIRI_SOCKET not being available.

Copy link
Copy Markdown
Owner

@BirdeeHub BirdeeHub May 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

systemd sees that the value of X-Reload-Triggers has changed, and runs E

ah ok that makes some sense actually

Given that several people have mentioned this, lgtm! Thanks for the explanation!

@BirdeeHub BirdeeHub merged commit 6316917 into BirdeeHub:main May 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants