tinc service: add CLI tools to the $PATH

Now user can execute e.g. "sudo tinc.netname dump nodes"
This commit is contained in:
Volth 2017-07-21 13:43:44 +00:00 committed by Franz Pletz
parent b33b40036b
commit 00512470ec

View File

@ -194,6 +194,19 @@ in
})
);
environment.systemPackages = let
cli-wrappers = pkgs.stdenv.mkDerivation {
name = "tinc-cli-wrappers";
buildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
${concatStringsSep "\n" (mapAttrsToList (network: data: ''
makeWrapper ${data.package}/bin/tinc "$out/bin/tinc.${network}" --add-flags "--pidfile=/run/tinc.${network}.pid"
'') cfg.networks)}
'';
};
in [ cli-wrappers ];
users.extraUsers = flip mapAttrs' cfg.networks (network: _:
nameValuePair ("tinc.${network}") ({
description = "Tinc daemon user for ${network}";