1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00

systemd: Simplify unit script names

Current journal output from services started by `script` rather than
`ExexStart` is unreadable because the name of the file (which journalctl
records and outputs) quite literally takes 1/3 of the screen (on smaller
screens).

Make it shorter. In particular:

* Drop the `unit-script` prefix as it is not very useful.
* Use `writeShellScriptBin` to write them because:
  * It has a `checkPhase` which is better than no checkPhase.
  * The script itself ends up having a short name.
This commit is contained in:
Kirill Elagin 2020-04-17 10:12:34 +03:00
parent 1d20b2872f
commit 5822d03851

View file

@ -201,8 +201,13 @@ let
];
makeJobScript = name: text:
let mkScriptName = s: "unit-script-" + (replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape s) );
in pkgs.writeTextFile { name = mkScriptName name; executable = true; inherit text; };
let
scriptName = replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
out = pkgs.writeShellScriptBin scriptName ''
set -e
${text}
'';
in "${out}/bin/${scriptName}";
unitConfig = { config, options, ... }: {
config = {