Skip to content

Safe and readable ExecStart for systemd proposal #154123

@roberth

Description

@roberth

Describe the bug

ExecStart is hard to read and write.

script is only suitable for a subset of use cases. (#135557, maybe other problems?)

  • No prefixes
  • No substitutions whatsoever
  • Only ExecStart

Expected behavior

  • Uphold the rule that a string is a string unless explicitly requested to be modified.
  • Use module system enums instead of cryptic prefixes (or perhaps add a bool if a prefix can always be combined etc; haven't fully dissected those)
  • Manage expectations: these aren't bash statements

It might look like this:

systemd.services.foo = {
  execStarts = [  # plural; it's a list
    { mode = "privileged";  # `+` prefix; TODO need to research exactly how prefixes combine
      exe = "echoAll";
      args = [ "$a" { substitute = "%i"; } ];  # escaped by default. not escaped when in { substitute = x; }
    }
  ]
}

Maybe even s/args/argv. More explicit, but also cryptic if you don't know C.

Additional context

man systemd.service (Exec* family of fields)
man systemd.unit (substitutions)

Notify maintainers

@NixOS/systemd

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions