Skip to content

lib.modules: init systemd#144

Open
Lassulus wants to merge 1 commit intomainfrom
systemd
Open

lib.modules: init systemd#144
Lassulus wants to merge 1 commit intomainfrom
systemd

Conversation

@Lassulus
Copy link
Copy Markdown
Owner

Add a systemd module that generates service files from wrapper config.

The module reuses NixOS systemd.services options directly, and picks up ExecStart, Environment, PATH, preStart and postStop from the wrapper automatically.

A single config.systemd option produces both user and system service outputs (outputs.systemd-user, outputs.systemd-system), differing only in the install directory.

Includes tests and README documentation with NixOS and home-manager examples.

Add a systemd module that generates service files from wrapper config.

The module reuses NixOS systemd.services options directly, and picks up
ExecStart, Environment, PATH, preStart and postStop from the wrapper
automatically.

A single config.systemd option produces both user and system service
outputs (outputs.systemd-user, outputs.systemd-system), differing only
in the install directory.

Includes tests and README documentation with NixOS and home-manager
examples.
Copy link
Copy Markdown
Collaborator

@zimward zimward left a comment

Choose a reason for hiding this comment

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

looks good to me, already know a usecase

_file = "lib/modules/systemd.nix";

options.systemd = lib.mkOption {
type = lib.types.submodule { freeformType = with lib.types; attrsOf anything; };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I understand this correctly, this also allows setting the NixOS option startAt to create a timer for the unit. I think it would be cool if the timer could end up in the outputs?

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