Move from ExecStart{,Pre} to systemd.nix attributes

This commit is contained in:
Robert Irelan 2016-05-16 14:06:36 -07:00
parent a712d8ff0b
commit 40d4f6df81

View File

@ -107,8 +107,7 @@ let cfg = config.services.subsonic; in {
description = "Personal media streamer";
after = [ "local-fs.target" "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
script = ''
${pkgs.jre}/bin/java -Xmx${toString cfg.maxMemory}m \
-Dsubsonic.home=${cfg.home} \
-Dsubsonic.host=${cfg.listenAddress} \
@ -122,8 +121,9 @@ let cfg = config.services.subsonic; in {
-verbose:gc \
-jar ${pkgs.subsonic}/subsonic-booter-jar-with-dependencies.jar
'';
preStart = ''
# Install transcoders.
ExecStartPre = ''
${pkgs.coreutils}/bin/rm -rf ${cfg.home}/transcode ; \
${pkgs.coreutils}/bin/mkdir -p ${cfg.home}/transcode ; \
${pkgs.bash}/bin/bash -c ' \
@ -131,6 +131,7 @@ let cfg = config.services.subsonic; in {
${pkgs.coreutils}/bin/ln -sf "$exe" ${cfg.home}/transcode; \
done' IGNORED_FIRST_ARG ${toString cfg.transcoders}
'';
serviceConfig = {
# Needed for Subsonic to find subsonic.war.
WorkingDirectory = "${pkgs.subsonic}";
Restart = "always";