Modular Services: Difference between revisions

Ehmry (talk | contribs)
Research Topics: Intra-service dependencies
Ehmry (talk | contribs)
Do not's: $PATH
Line 7: Line 7:
== Do's ==
== Do's ==


== Do not Do's ==
== Do not's ==
 
=== Depend on anything already being in $PATH ===
 
Don't expect any programs to be available, not even GNU coreutils.
 
Start the services program using a full path and if you need to write a script then set PATH there.
 
Setting a $PATH with a shell script:
<syntaxHighlight lang=nix>
{
  process.argv = [
    (pkgs.writeShellScript "foo.sh" ''
      PATH="${lib.makeBinPath [ pkgs.foo pkgs.bar pkgs.coreutils ]}"
 
      mkdir /var/lib/foo
      foo …
    '')
  ];
}
</syntaxHighlight>
 
Or set PATH without a script using [[execline]]:
<syntaxHighlight lang=nix>
{
  process.argv = [
    "${pkgs.execline}/bin/export" "PATH" (lib.makeBinPath [ pkgs.foo pkgs.bar ])
    "foo" "…"
  ];
}
</syntaxHighlight>


== Research Topics ==
== Research Topics ==