Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining services is punishingly complicated #12

Open
t184256 opened this issue Nov 5, 2017 · 0 comments
Open

Defining services is punishingly complicated #12

t184256 opened this issue Nov 5, 2017 · 0 comments

Comments

@t184256
Copy link

t184256 commented Nov 5, 2017

Not sure whether to file that against disnix or dysnomia. Also I should warn in advance that I'm only one week into the Nix world and clearly not Nix-minded enough yet.

If one wants to use Disnix to run a process that requires even a single command line argument, e.g. iperf -s, one must jump through so many hoops it's not even funny.

If I understood correctly, launching it without the -s would've required just iperf = { name = "iperf"; pkg = pkgs.iperf; type = "process"; };. But in order to add that little -s one must:
0. Specify type = "wrapper";.

  1. Write a wrapper for it (your way seems to be: create a directory, write a wrapper, reuse a templating Makefile, compile (!) it)
  2. Override a derivation and build it with the wrapper baked in (I can't even grasp how at the moment).

Am I wrong? Can the process be streamlined somehow? At the moment it's easier to overrideAttrs on the package and patch the sources to imply that '-s' than to make a wrapper.

Ideally I'd like to specify type = "process"; args = ["-s"]; for this trivial operation and something like

baseDir = "/var/lib/service";
type = modularWrapper {
  collectGarbage = ''
    rm -r $baseDir
  '';
  systemdUnit = ''
    [Unit]
    After=disnix.service

    [Install]
    WantedBy=dysnomia.target

    [Service]
    Environment=PATH=${dysnomia.systemdPath}
    Type=simple;
  '';
};

for more complex ones. Is this possible?

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

No branches or pull requests

1 participant