Add missing newline and indentation

master
Sven Slootweg 7 years ago
parent 9deabe3699
commit a2a7b42ed8

@ -1,48 +1,49 @@
{pkgs, config, ...}@args: {src, name, mainBinaryPath, setupCommands ? "", serviceOptions ? {}, serviceConfig ? {}, hasErrorReporting ? false, errorPath ? null}: {pkgs, config, ...}@args:
with pkgs.stdenv.lib; {src, name, mainBinaryPath, setupCommands ? "", serviceOptions ? {}, serviceConfig ? {}, hasErrorReporting ? false, errorPath ? null}:
with pkgs.stdenv.lib;
let let
buildNode2nixPackage = (import ./build/node2nix-package.nix) args; buildNode2nixPackage = (import ./build/node2nix-package.nix) args;
in let in let
serviceName = "node-${name}"; serviceName = "node-${name}";
cfg = config.services."${serviceName}"; cfg = config.services."${serviceName}";
application = buildNode2nixPackage { application = buildNode2nixPackage {
name = "${serviceName}-source"; name = "${serviceName}-source";
inherit src setupCommands; inherit src setupCommands;
}; };
errorReporter = (import ./node-error-reporter) args; errorReporter = (import ./node-error-reporter) args;
errorReporterModule = if hasErrorReporting then (errorReporter { errorReporterModule = if hasErrorReporting then (errorReporter {
application = application; application = application;
applicationName = name; applicationName = name;
errorPath = errorPath; errorPath = errorPath;
}) else null; }) else null;
in { in {
imports = [ imports = [
errorReporterModule errorReporterModule
]; ];
options.services."${serviceName}" = { options.services."${serviceName}" = {
enable = mkEnableOption "${name}"; enable = mkEnableOption "${name}";
} // serviceOptions; } // serviceOptions;
config = { config = {
# FIXME: What if a username conflict occurs? # FIXME: What if a username conflict occurs?
users.extraUsers."${name}" = mkIf cfg.enable { users.extraUsers."${name}" = mkIf cfg.enable {
description = "${name} Service User"; description = "${name} Service User";
}; };
systemd.services."${serviceName}" = mkIf cfg.enable ({ systemd.services."${serviceName}" = mkIf cfg.enable ({
description = "${name} Service"; description = "${name} Service";
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
after = ["network.target"]; after = ["network.target"];
serviceConfig = { serviceConfig = {
ExecStart = "${application}/${mainBinaryPath}"; ExecStart = "${application}/${mainBinaryPath}";
User = name; User = name;
PermissionsStartOnly = true; PermissionsStartOnly = true;
}; };
} // serviceConfig); } // serviceConfig);
}; };
} }

Loading…
Cancel
Save