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