Skip to content

feat(wrapperModules.ashell): add systemd integration - #665

Merged
BirdeeHub merged 1 commit into
nix-community:mainfrom
szymon-jozef:feat/ashell-systemd-service
Nov 15, 2026
Merged

BirdeeHub merged 1 commit into
nix-community:mainfrom
szymon-jozef:feat/ashell-systemd-service

Conversation

@szymon-jozef

Copy link
Copy Markdown
Contributor

Makes it easier to autostart ashell after entering graphical session.

I'm not sure if I should add myself to the maintainers list, since It's my first PR to a nix repo and I'm only adding a small functionality, so as of now I haven't. If I should, please let me know

builder = ''${pkgs.remarshal}/bin/json2toml "$1" "$2"'';
};
config.systemd.user.service.ashell = {
overwrite = true;

@BirdeeHub BirdeeHub Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So, overwrite isn't technically necessary here, as the ashell derivation does not already offer an existing service named ashell.

That being said, if they do decide to offer one at some point, using overwrite = true here would prevent unexpected effects from happening as a result of that. But it would also mean that if they add extra useful fields you won't get those too as part of your service definition. The ones you define here would be defined after theirs and would thus win, but who knows what they add to be fair.

Honestly I am fine with either way, just letting you know the difference.

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.

Thanks for letting me know. I think I'd prefer to keep it set to true, to avoid problems if people at nixpkgs decide to add this service themselves.

@BirdeeHub

BirdeeHub commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

I'm not sure if I should add myself to the maintainers list

You add yourself to the maintainers list if you are A, the person who submitted the module, or B, you would be ok with being added to the list of people I ping when an issue is found with the module or a PR is made to improve it that I do not immediately understand or is difficult for me to quickly test.

Actually, on that note, I do think I understand this just fine, but @aliaslion what do you think?

Comment thread wrapperModules/a/ashell/module.nix Outdated
'';
};
systemdTarget = lib.mkOption {
type = lib.types.str;

@BirdeeHub BirdeeHub Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should probably make this lib.types.nullOr lib.types.str and not generate the service if null? There is a chance there are some people who are installing it via the install module, who would also like to be able to more easily disable this behavior to run it directly from an exec in their window manager config without going into the install.systemd option. Also there are even more likely to be people doing that because we didn't have this feature before now.

Otherwise I like it.

graphical-session.target is meant to be fired once the window manager is ready, which is when you would want to spawn your shell, so this is the correct target.

It does not always do this correctly on x11 on nixos? Sometimes it fires right before the window manager starts up? But ashell is a wayland thing, so it should do this correctly, and if not they can always change what service it fires on.

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.

Thanks for the review. I changed the type and now I only generate systemd service, if it's not null.

@BirdeeHub BirdeeHub Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh, also, the reason it was extra important that it have a way to disable it is that it has Install.WantedBy, which actually enables the thing.

nix-wrapper-modules creates the .wants .upholds and .requires links itself which when added to the systemd unit path act as if you have enabled the service (or, at least, once you restart anyway... and subsequent changes or starting it manually don't need the restart, just to enable a service of that name the first time)

There are some other services in this repository that you have to start yourself, and those do not usually have a mkIf on them.

I should probably add that to the contributing docs somewhere. Most of that is described in the systemd docs as it pertains to how it works, but I do not include that this would mean that for submitted modules it would be a good idea to make it optional if it includes things that can automatically enable it.

makes it easier to autostart ashell after entering graphical session
@szymon-jozef
szymon-jozef force-pushed the feat/ashell-systemd-service branch from f60f408 to f597534 Compare November 15, 2026 23:32
@BirdeeHub

BirdeeHub commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

The macos tests randomly started taking twice as long to run recently... I am not super amused about this and might need to start thinking about how to make it only run the relevant tests per PR. Locally it is still just as fast, something happened on github's end.

@BirdeeHub
BirdeeHub merged commit f550561 into nix-community:main Nov 15, 2026
2 checks passed
@aliaslion

Copy link
Copy Markdown
Contributor

Great change, didn't even know that was possible.
Was doing basically the same thing outside wrappers in my config.

Thank you!

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.

3 participants