Merge pull request #12198 from mayflower/remove-upstart-layer

Remove upstart layer
This commit is contained in:
Daniel Peebles 2016-01-07 13:47:39 -05:00
commit 57cb5ab17a
54 changed files with 772 additions and 1645 deletions

View File

@ -149,8 +149,7 @@ in
# not be started by default on the installation CD because the # not be started by default on the installation CD because the
# default root password is empty. # default root password is empty.
services.openssh.enable = true; services.openssh.enable = true;
systemd.services.openssh.wantedBy = lib.mkOverride 50 [];
jobs.openssh.startOn = lib.mkOverride 50 "";
boot.loader.grub.enable = false; boot.loader.grub.enable = false;
boot.loader.generationsDir.enable = false; boot.loader.generationsDir.enable = false;

View File

@ -164,7 +164,7 @@ in
# not be started by default on the installation CD because the # not be started by default on the installation CD because the
# default root password is empty. # default root password is empty.
services.openssh.enable = true; services.openssh.enable = true;
jobs.openssh.startOn = lib.mkOverride 50 ""; systemd.services.openssh.wantedBy = lib.mkOverride 50 [];
# cpufrequtils fails to build on non-pc # cpufrequtils fails to build on non-pc
powerManagement.enable = false; powerManagement.enable = false;

View File

@ -100,8 +100,6 @@
./services/amqp/activemq/default.nix ./services/amqp/activemq/default.nix
./services/amqp/rabbitmq.nix ./services/amqp/rabbitmq.nix
./services/audio/alsa.nix ./services/audio/alsa.nix
# Disabled as fuppes no longer builds.
# ./services/audio/fuppes.nix
./services/audio/icecast.nix ./services/audio/icecast.nix
./services/audio/liquidsoap.nix ./services/audio/liquidsoap.nix
./services/audio/mpd.nix ./services/audio/mpd.nix
@ -477,7 +475,6 @@
./system/boot/timesyncd.nix ./system/boot/timesyncd.nix
./system/boot/tmp.nix ./system/boot/tmp.nix
./system/etc/etc.nix ./system/etc/etc.nix
./system/upstart/upstart.nix
./tasks/bcache.nix ./tasks/bcache.nix
./tasks/cpu-freq.nix ./tasks/cpu-freq.nix
./tasks/encrypted-devices.nix ./tasks/encrypted-devices.nix

View File

@ -1,115 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.fuppesd;
in
with lib;
{
options = {
services.fuppesd = {
enable = mkOption {
default = false;
type = with types; bool;
description = ''
Enables Fuppes (UPnP A/V Media Server). Can be used to watch
photos, video and listen to music from a phone/tv connected to the
local network.
'';
};
name = mkOption {
example = "Media Center";
type = types.str;
description = ''
Enables Fuppes (UPnP A/V Media Server). Can be used to watch
photos, video and listen to music from a phone/tv connected to the
local network.
'';
};
log = {
level = mkOption {
default = 0;
example = 3;
type = with types; uniq int;
description = ''
Logging level of fuppes, An integer between 0 and 3.
'';
};
file = mkOption {
default = "/var/log/fuppes.log";
type = types.str;
description = ''
File which will contains the log produced by the daemon.
'';
};
};
config = mkOption {
example = "/etc/fuppes/fuppes.cfg";
type = types.str;
description = ''
Mutable configuration file which can be edited with the web
interface. Due to possible modification, double quote the full
path of the filename stored in your filesystem to avoid attempts
to modify the content of the nix store.
'';
};
vfolder = mkOption {
example = literalExample "/etc/fuppes/vfolder.cfg";
description = ''
XML file describing the layout of virtual folder visible by the
client.
'';
};
database = mkOption {
default = "/var/lib/fuppes/fuppes.db";
type = types.str;
description = ''
Database file which index all shared files.
'';
};
## At the moment, no plugins are packaged.
/*
plugins = mkOption {
type = with types; listOf package;
description = ''
List of Fuppes plugins.
'';
};
*/
user = mkOption {
default = "root"; # The default is not secure.
example = "fuppes";
type = types.str;
description = ''
Name of the user which own the configuration files and under which
the fuppes daemon will be executed.
'';
};
};
};
config = mkIf cfg.enable {
jobs.fuppesd = {
description = "UPnP A/V Media Server. (${cfg.name})";
startOn = "ip-up";
daemonType = "fork";
exec = ''/var/setuid-wrappers/sudo -u ${cfg.user} -- ${pkgs.fuppes}/bin/fuppesd --friendly-name ${cfg.name} --log-level ${toString cfg.log.level} --log-file ${cfg.log.file} --config-file ${cfg.config} --vfolder-config-file ${cfg.vfolder} --database-file ${cfg.database}'';
};
services.fuppesd.name = mkDefault config.networking.hostName;
services.fuppesd.vfolder = mkDefault ./fuppes/vfolder.cfg;
security.sudo.enable = true;
};
}

View File

@ -1,155 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<fuppes_vfolder_config version="0.2">
<vfolder_layout device="default" enabled="false">
<vfolder name="Genre">
<vfolders property="genre">
<items type="audioItem" />
</vfolders>
</vfolder>
<vfolder name="Genre/Artists">
<vfolders property="genre">
<vfolders property="artist">
<items type="audioItem" />
</vfolders>
</vfolders>
</vfolder>
<vfolder name="Artists/Albums">
<vfolders property="artist">
<vfolders property="album">
<items type="audioItem" />
</vfolders>
</vfolders>
</vfolder>
<vfolder name="ABC/Artists/Albums">
<vfolders split="ABC">
<vfolders property="artist">
<vfolders property="album">
<items type="audioItem" />
</vfolders>
</vfolders>
</vfolders>
</vfolder>
<vfolder name="Photos">
<vfolder name="All">
<items type="imageItem" />
</vfolder>
<vfolder name="Folders">
<folders filter="contains(imageItem)" />
</vfolder>
</vfolder>
<vfolder name="Videos">
<vfolder name="All">
<items type="videoItem" />
</vfolder>
<vfolder name="Folders">
<folders filter="contains(videoItem)" />
</vfolder>
</vfolder>
<vfolder name="shared dirs">
<shared_dirs full_extend="true" />
</vfolder>
</vfolder_layout>
<vfolder_layout device="Xbox 360" enabled="false">
<vfolder name="Music" id="1">
<vfolder name="Album" id="7">
<vfolders property="album">
<items type="audioItem" />
</vfolders>
</vfolder>
<vfolder name="All Music" id="4">
<items type="audioItem" />
</vfolder>
<vfolder name="Artist" id="6">
<vfolders property="artist">
<items type="audioItem" />
</vfolders>
</vfolder>
<vfolder name="Folders" id="20">
<folders filter="contains(audioItem)" />
</vfolder>
<vfolder name="Genre" id="5">
<vfolders property="genre">
<items type="audioItem" />
</vfolders>
</vfolder>
<vfolder name="Playlist" id="15" />
</vfolder>
<vfolder name="Pictures" id="3">
<vfolder name="Album" id="13" />
<vfolder name="All Pictures" id="11">
<items type="imageItem" />
</vfolder>
<vfolder name="Date Taken" id="12" />
<vfolder name="Folders" id="22">
<folders filter="contains(imageItem)" />
</vfolder>
</vfolder>
<vfolder name="Playlists" id="18">
<vfolder name="All Playlists" id="19" />
<vfolder name="Folders" id="23" />
</vfolder>
<vfolder name="Video" id="2">
<vfolder name="Actor" id="10" />
<vfolder name="Album" id="14" />
<vfolder name="All Video" id="8">
<items type="videoItem" />
</vfolder>
<vfolder name="Folders" id="21">
<folders filter="contains(videoItem)" />
</vfolder>
<vfolder name="Genre" id="9" />
</vfolder>
</vfolder_layout>
<vfolder_layout device="Yamaha" enabled="false" create_references="true" >
<vfolder name="Playlists" />
<vfolder name="Artists">
<vfolders property="artist">
<items type="audioItem" />
</vfolders>
</vfolder>
<vfolder name="Albums">
<vfolders property="album">
<items type="audioItem" />
</vfolders>
</vfolder>
<vfolder name="Songs">
<items type="audioItem" />
</vfolder>
<vfolder name="Genres">
<vfolders property="genre">
<items type="audioItem" />
</vfolders>
</vfolder>
</vfolder_layout>
</fuppes_vfolder_config>

View File

@ -60,11 +60,9 @@ with lib;
services.avahi.enable = true; services.avahi.enable = true;
jobs.fourStoreEndpoint = { systemd.services."4store-endpoint" = {
name = "4store-endpoint"; wantedBy = [ "ip-up.target" ];
startOn = "ip-up"; script = ''
exec = ''
${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}' ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
''; '';
}; };

View File

@ -52,9 +52,8 @@ with lib;
services.avahi.enable = true; services.avahi.enable = true;
jobs.fourStore = { systemd.services."4store" = {
name = "4store"; wantedBy = [ "ip-up.target" ];
startOn = "ip-up";
preStart = '' preStart = ''
mkdir -p ${stateDir}/ mkdir -p ${stateDir}/
@ -64,11 +63,9 @@ with lib;
fi fi
''; '';
exec = '' script = ''
${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}' ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}'
''; '';
}; };
}; };
} }

View File

@ -61,9 +61,8 @@ with lib;
home = stateDir; home = stateDir;
}; };
jobs.virtuoso = { systemd.services.virtuoso = {
name = "virtuoso"; wantedBy = [ "ip-up.target" ];
startOn = "ip-up";
preStart = '' preStart = ''
mkdir -p ${stateDir} mkdir -p ${stateDir}

View File

@ -78,8 +78,8 @@ in
bot_replaypath = replays bot_replaypath = replays
''; '';
jobs.ghostOne = { systemd.services."ghost-one" = {
name = "ghost-one"; wantedBy = [ "multi-user.target" ];
script = '' script = ''
mkdir -p ${stateDir} mkdir -p ${stateDir}
cd ${stateDir} cd ${stateDir}

View File

@ -98,20 +98,24 @@ in
config = mkIf config.services.acpid.enable { config = mkIf config.services.acpid.enable {
jobs.acpid = systemd.services.acpid = {
{ description = "ACPI Daemon"; description = "ACPI Daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "systemd-udev-settle.service" ]; after = [ "systemd-udev-settle.service" ];
path = [ pkgs.acpid ]; path = [ pkgs.acpid ];
daemonType = "fork"; serviceConfig = {
Type = "forking";
};
exec = "acpid --confdir ${acpiConfDir}"; unitConfig = {
ConditionVirtualization = "!systemd-nspawn";
ConditionPathExists = [ "/proc/acpi" ];
};
unitConfig.ConditionVirtualization = "!systemd-nspawn"; script = "acpid --confdir ${acpiConfDir}";
unitConfig.ConditionPathExists = [ "/proc/acpi" ];
}; };
}; };

View File

@ -35,18 +35,13 @@ with lib;
services.dbus.packages = [ pkgs.pommed ]; services.dbus.packages = [ pkgs.pommed ];
jobs.pommed = { name = "pommed"; systemd.services.pommed = {
description = "Pommed hotkey management"; description = "Pommed hotkey management";
wantedBy = [ "multi-user.target" ];
startOn = "started dbus"; after = [ "dbus.service" ];
postStop = "rm -f /var/run/pommed.pid"; postStop = "rm -f /var/run/pommed.pid";
script = "${pkgs.pommed}/bin/pommed";
exec = "${pkgs.pommed}/bin/pommed"; serviceConfig.Type = "forking";
daemonType = "fork";
path = [ pkgs.eject ]; path = [ pkgs.eject ];
}; };
}; };

View File

@ -24,21 +24,14 @@ with lib;
###### implementation ###### implementation
config = mkIf config.services.klogd.enable { config = mkIf config.services.klogd.enable {
systemd.services.klogd = {
jobs.klogd = description = "Kernel Log Daemon";
{ description = "Kernel Log Daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = [ pkgs.sysklogd ]; path = [ pkgs.sysklogd ];
unitConfig.ConditionVirtualization = "!systemd-nspawn"; unitConfig.ConditionVirtualization = "!systemd-nspawn";
script =
exec =
"klogd -c 1 -2 -n " + "klogd -c 1 -2 -n " +
"-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map"; "-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
}; };
}; };
} }

View File

@ -72,10 +72,11 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
jobs.freepopsd = { systemd.services.freepopsd = {
description = "Freepopsd (webmail over POP3)"; description = "Freepopsd (webmail over POP3)";
startOn = "ip-up"; wantedBy = [ "ip-up.target" ];
exec = ''${pkgs.freepops}/bin/freepopsd \ script = ''
${pkgs.freepops}/bin/freepopsd \
-p ${toString cfg.port} \ -p ${toString cfg.port} \
-t ${toString cfg.threads} \ -t ${toString cfg.threads} \
-b ${cfg.bind} \ -b ${cfg.bind} \

View File

@ -50,15 +50,13 @@ in
gid = config.ids.gids.spamd; gid = config.ids.gids.spamd;
}; };
jobs.spamd = { systemd.services.spamd = {
description = "Spam Assassin Server"; description = "Spam Assassin Server";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
exec = "${pkgs.spamassassin}/bin/spamd ${optionalString cfg.debug "-D"} --username=spamd --groupname=spamd --nouser-config --virtual-config-dir=/var/lib/spamassassin/user-%u --allow-tell --pidfile=/var/run/spamd.pid"; script = "${pkgs.spamassassin}/bin/spamd ${optionalString cfg.debug "-D"} --username=spamd --groupname=spamd --nouser-config --virtual-config-dir=/var/lib/spamassassin/user-%u --allow-tell --pidfile=/var/run/spamd.pid";
}; };
}; };
} }

View File

@ -51,13 +51,12 @@ with lib;
gid = config.ids.gids.dictd; gid = config.ids.gids.dictd;
}; };
jobs.dictd = systemd.services.dictd = {
{ description = "DICT.org Dictionary Server"; description = "DICT.org Dictionary Server";
startOn = "startup"; wantedBy = [ "multi-user.target" ];
environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; }; environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; };
daemonType = "fork"; serviceConfig.Type = "forking";
exec = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8"; script = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8";
}; };
}; };
} }

View File

@ -117,10 +117,9 @@ in
services.disnix.publishInfrastructure.enable = cfg.publishAvahi; services.disnix.publishInfrastructure.enable = cfg.publishAvahi;
jobs = { systemd.services = {
disnix = disnix = {
{ description = "Disnix server"; description = "Disnix server";
wants = [ "dysnomia.target" ]; wants = [ "dysnomia.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "dbus.service" ] after = [ "dbus.service" ]
@ -150,16 +149,15 @@ in
fi fi
''; '';
exec = "disnix-service"; script = "disnix-service";
}; };
} // optionalAttrs cfg.publishAvahi { } // optionalAttrs cfg.publishAvahi {
disnixAvahi = disnixAvahi = {
{ description = "Disnix Avahi publisher"; description = "Disnix Avahi publisher";
wants = [ "avahi-daemon.service" ];
wantedBy = [ "multi-user.target" ];
startOn = "started avahi-daemon"; script = ''
exec =
''
${pkgs.avahi}/bin/avahi-publish-service disnix-${config.networking.hostName} _disnix._tcp 22 \ ${pkgs.avahi}/bin/avahi-publish-service disnix-${config.networking.hostName} _disnix._tcp 22 \
"mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e 's/MemTotal://' -e 's/ //g')" \ "mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e 's/MemTotal://' -e 's/ //g')" \
${concatMapStrings (infrastructureAttrName: ${concatMapStrings (infrastructureAttrName:

View File

@ -57,11 +57,11 @@ in
home = "/homeless-shelter"; home = "/homeless-shelter";
}; };
jobs.felix = systemd.services.felix = {
{ description = "Felix server"; description = "Felix server";
wantedBy = [ "multi-user.target" ];
preStart = preStart = ''
''
# Initialise felix instance on first startup # Initialise felix instance on first startup
if [ ! -d /var/felix ] if [ ! -d /var/felix ]
then then
@ -98,13 +98,10 @@ in
fi fi
''; '';
script = script = ''
''
cd /var/felix cd /var/felix
${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c '${pkgs.jre}/bin/java -jar bin/felix.jar' ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c '${pkgs.jre}/bin/java -jar bin/felix.jar'
''; '';
}; };
}; };
} }

View File

@ -49,26 +49,20 @@ in {
home = stateDir; home = stateDir;
}; };
jobs.foldingAtHome = systemd.services.foldingathome = {
{ name = "foldingathome"; after = [ "network-interfaces.target" ];
wantedBy = [ "multi-user.target" ];
startOn = "started network-interfaces"; preStart = ''
stopOn = "stopping network-interfaces";
preStart =
''
mkdir -m 0755 -p ${stateDir} mkdir -m 0755 -p ${stateDir}
chown ${fahUser} ${stateDir} chown ${fahUser} ${stateDir}
cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg
''; '';
exec = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'"; script = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'";
}; };
services.foldingAtHome.config = '' services.foldingAtHome.config = ''
[settings] [settings]
username=${cfg.nickname} username=${cfg.nickname}
''; '';
}; };
} }

View File

@ -34,13 +34,11 @@ in
###### implementation ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable {
jobs.svnserve = { systemd.services.svnserve = {
startOn = "started network-interfaces"; after = [ "network-interfaces.target" ];
stopOn = "stopping network-interfaces"; wantedBy = [ "multi-user.target" ];
preStart = "mkdir -p ${cfg.svnBaseDir}"; preStart = "mkdir -p ${cfg.svnBaseDir}";
script = "${pkgs.subversion}/bin/svnserve -r ${cfg.svnBaseDir} -d --foreground --pid-file=/var/run/svnserve.pid";
exec = "${pkgs.subversion}/bin/svnserve -r ${cfg.svnBaseDir} -d --foreground --pid-file=/var/run/svnserve.pid";
}; };
}; };
} }

View File

@ -19,10 +19,6 @@ in
default = ""; default = "";
description = "monit.conf content"; description = "monit.conf content";
}; };
startOn = mkOption {
default = "started network-interfaces";
description = "What Monit supposes to be already present";
};
}; };
}; };
@ -39,14 +35,12 @@ in
} }
]; ];
jobs.monit = { systemd.services.monit = {
description = "Monit system watcher"; description = "Monit system watcher";
after = [ "network-interfaces.target" ];
startOn = config.services.monit.startOn; wantedBy = [ "multi-user.target" ];
script = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf";
exec = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf"; serviceConfig.Restart = "always";
respawn = true;
}; };
}; };
} }

View File

@ -180,31 +180,36 @@ in
environment.systemPackages = [ pkgs.nut ]; environment.systemPackages = [ pkgs.nut ];
jobs.upsmon = { systemd.services.upsmon = {
description = "Uninterruptible Power Supplies (Monitor)"; description = "Uninterruptible Power Supplies (Monitor)";
startOn = "ip-up"; wantedBy = [ "ip-up.target" ];
daemonType = "fork"; serviceConfig.Type = "forking";
exec = ''${pkgs.nut}/sbin/upsmon''; script = "${pkgs.nut}/sbin/upsmon";
environment.NUT_CONFPATH = "/etc/nut/"; environment.NUT_CONFPATH = "/etc/nut/";
environment.NUT_STATEPATH = "/var/lib/nut/"; environment.NUT_STATEPATH = "/var/lib/nut/";
}; };
jobs.upsd = { systemd.services.upsd = {
description = "Uninterruptible Power Supplies (Daemon)"; description = "Uninterruptible Power Supplies (Daemon)";
startOn = "started network-interfaces and started upsmon"; wantedBy = [ "multi-user.target" ];
daemonType = "fork"; after = [ "network-interfaces.target" "upsmon.service" ];
serviceConfig.Type = "forking";
# TODO: replace 'root' by another username. # TODO: replace 'root' by another username.
exec = ''${pkgs.nut}/sbin/upsd -u root''; script = "${pkgs.nut}/sbin/upsd -u root";
environment.NUT_CONFPATH = "/etc/nut/"; environment.NUT_CONFPATH = "/etc/nut/";
environment.NUT_STATEPATH = "/var/lib/nut/"; environment.NUT_STATEPATH = "/var/lib/nut/";
}; };
jobs.upsdrv = { systemd.services.upsdrv = {
description = "Uninterruptible Power Supplies (Register all UPS)"; description = "Uninterruptible Power Supplies (Register all UPS)";
startOn = "started upsd"; wantedBy = [ "multi-user.target" ];
after = [ "upsd.service" ];
# TODO: replace 'root' by another username. # TODO: replace 'root' by another username.
exec = ''${pkgs.nut}/bin/upsdrvctl -u root start''; script = ''${pkgs.nut}/bin/upsdrvctl -u root start'';
task = true; serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
environment.NUT_CONFPATH = "/etc/nut/"; environment.NUT_CONFPATH = "/etc/nut/";
environment.NUT_STATEPATH = "/var/lib/nut/"; environment.NUT_STATEPATH = "/var/lib/nut/";
}; };

View File

@ -52,26 +52,16 @@ let cfg = config.services.drbd; in
target = "drbd.conf"; target = "drbd.conf";
}; };
jobs.drbd_up = systemd.services.drbd = {
{ name = "drbd-up"; after = [ "systemd-udev.settle.service" ];
startOn = "stopped udevtrigger or ip-up"; wants = [ "systemd-udev.settle.service" ];
task = true; wantedBy = [ "ip-up.target" ];
script = script = ''
''
${pkgs.drbd}/sbin/drbdadm up all ${pkgs.drbd}/sbin/drbdadm up all
''; '';
}; serviceConfig.ExecStop = ''
jobs.drbd_down =
{ name = "drbd-down";
startOn = "starting shutdown";
task = true;
script =
''
${pkgs.drbd}/sbin/drbdadm down all ${pkgs.drbd}/sbin/drbdadm down all
''; '';
}; };
}; };
} }

View File

@ -72,13 +72,10 @@ in
} }
]; ];
jobs.openafsClient = systemd.services.afsd = {
{ name = "afsd";
description = "AFS client"; description = "AFS client";
wantedBy = [ "multi-user.target" ];
startOn = "started network-interfaces"; after = [ "network-interfaces.target" ];
stopOn = "stopping network-interfaces";
preStart = '' preStart = ''
mkdir -p -m 0755 /afs mkdir -p -m 0755 /afs
@ -97,9 +94,6 @@ in
${openafsPkgs}/sbin/afsd -shutdown ${openafsPkgs}/sbin/afsd -shutdown
${pkgs.module_init_tools}/sbin/rmmod libafs ${pkgs.module_init_tools}/sbin/rmmod libafs
''; '';
}; };
}; };
} }

View File

@ -57,22 +57,19 @@ in
gid = config.ids.gids.amule; gid = config.ids.gids.amule;
} ]; } ];
jobs.amuled = systemd.services.amuled = {
{ description = "AMule daemon"; description = "AMule daemon";
wantedBy = [ "ip-up.target" ];
startOn = "ip-up";
preStart = '' preStart = ''
mkdir -p ${cfg.dataDir} mkdir -p ${cfg.dataDir}
chown ${user} ${cfg.dataDir} chown ${user} ${cfg.dataDir}
''; '';
exec = '' script = ''
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \ ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \
-c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled' -c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled'
''; '';
}; };
}; };
} }

View File

@ -142,20 +142,17 @@ in
description = "BIND daemon user"; description = "BIND daemon user";
}; };
jobs.bind = systemd.services.bind = {
{ description = "BIND name server job"; description = "BIND name server job";
after = [ "network-interfaces.target" ];
wantedBy = [ "multi-user.target" ];
startOn = "started network-interfaces"; preStart = ''
preStart =
''
${pkgs.coreutils}/bin/mkdir -p /var/run/named ${pkgs.coreutils}/bin/mkdir -p /var/run/named
chown ${bindUser} /var/run/named chown ${bindUser} /var/run/named
''; '';
exec = "${pkgs.bind}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f"; script = "${pkgs.bind}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
}; };
}; };
} }

View File

@ -56,20 +56,13 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.ejabberd ]; environment.systemPackages = [ pkgs.ejabberd ];
jobs.ejabberd = systemd.services.ejabberd = {
{ description = "EJabberd server"; description = "EJabberd server";
after = [ "network-interfaces.target" ];
startOn = "started network-interfaces"; wantedBy = [ "multi-user.target" ];
stopOn = "stopping network-interfaces"; path = with pkgs; [ ejabberd coreutils bash gnused ];
environment = {
PATH = "$PATH:${pkgs.ejabberd}/sbin:${pkgs.ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin";
};
preStart =
''
PATH="$PATH:${pkgs.ejabberd}/sbin:${pkgs.ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin";
preStart = ''
# Initialise state data # Initialise state data
mkdir -p ${cfg.logsDir} mkdir -p ${cfg.logsDir}
@ -126,8 +119,7 @@ in
''} ''}
''; '';
postStop = postStop = ''
''
ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} stop ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} stop
''; '';
}; };

View File

@ -115,10 +115,9 @@ in
gid = config.ids.gids.git; gid = config.ids.gids.git;
}; };
jobs.gitDaemon = { systemd.services."git-daemon" = {
name = "git-daemon"; wantedBy = [ "ip-up.target" ];
startOn = "ip-up"; script = "${pkgs.git}/bin/git daemon --reuseaddr "
exec = "${pkgs.git}/bin/git daemon --reuseaddr "
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ") + (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ") + (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
+ "--port=${toString cfg.port} --user=${cfg.user} --group=${cfg.group} ${cfg.options} " + "--port=${toString cfg.port} --user=${cfg.user} --group=${cfg.group} ${cfg.options} "

View File

@ -37,13 +37,6 @@ let
''; '';
executable = true; executable = true;
}); });
exec = "${pkgs.gvpe}/sbin/gvpe -c /var/gvpe -D ${cfg.nodename} "
+ " ${cfg.nodename}.pid-file=/var/gvpe/gvpe.pid"
+ " ${cfg.nodename}.if-up=if-up"
+ " &> /var/log/gvpe";
inherit (cfg) startOn stopOn;
in in
{ {
@ -55,18 +48,6 @@ in
Whether to run gvpe Whether to run gvpe
''; '';
}; };
startOn = mkOption {
default = "started network-interfaces";
description = ''
Condition to start GVPE
'';
};
stopOn = mkOption {
default = "stopping network-interfaces";
description = ''
Condition to stop GVPE
'';
};
nodename = mkOption { nodename = mkOption {
default = null; default = null;
description ='' description =''
@ -122,10 +103,10 @@ in
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
jobs.gvpe = { systemd.services.gvpe = {
description = "GNU Virtual Private Ethernet node"; description = "GNU Virtual Private Ethernet node";
after = [ "network-interfaces.target" ];
inherit startOn stopOn; wantedBy = [ "multi-user.target" ];
preStart = '' preStart = ''
mkdir -p /var/gvpe mkdir -p /var/gvpe
@ -136,9 +117,12 @@ in
cp ${ifupScript} /var/gvpe/if-up cp ${ifupScript} /var/gvpe/if-up
''; '';
inherit exec; script = "${pkgs.gvpe}/sbin/gvpe -c /var/gvpe -D ${cfg.nodename} "
+ " ${cfg.nodename}.pid-file=/var/gvpe/gvpe.pid"
+ " ${cfg.nodename}.if-up=if-up"
+ " &> /var/log/gvpe";
respawn = true; serviceConfig.Restart = "always";
}; };
}; };
} }

View File

@ -66,15 +66,11 @@ in
###### implementation ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.ifplugd = {
jobs.ifplugd = description = "Network interface connectivity monitor";
{ description = "Network interface connectivity monitor"; after = [ "network-interfaces.target" ];
wantedBy = [ "multi-user.target" ];
startOn = "started network-interfaces"; script = ''
stopOn = "stopping network-interfaces";
exec =
''
${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \ ${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \
${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \ ${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \
--run ${plugScript} --run ${plugScript}
@ -82,7 +78,5 @@ in
}; };
environment.systemPackages = [ ifplugd ]; environment.systemPackages = [ ifplugd ];
}; };
} }

View File

@ -121,17 +121,11 @@ in
users.extraGroups.ircd.gid = config.ids.gids.ircd; users.extraGroups.ircd.gid = config.ids.gids.ircd;
jobs.ircd_hybrid = systemd.services."ircd-hybrid" = {
{ name = "ircd-hybrid";
description = "IRCD Hybrid server"; description = "IRCD Hybrid server";
after = [ "started networking" ];
startOn = "started networking"; wantedBy = [ "multi-user.target" ];
stopOn = "stopping networking"; script = "${ircdService}/bin/control start";
exec = "${ircdService}/bin/control start";
}; };
}; };
} }

View File

@ -24,13 +24,12 @@ with lib;
###### implementation ###### implementation
config = mkIf config.services.oidentd.enable { config = mkIf config.services.oidentd.enable {
systemd.services.oidentd = {
jobs.oidentd = after = [ "network-interfaces.target" ];
{ startOn = "started network-interfaces"; wantedBy = [ "multi-user.target" ];
daemonType = "fork"; serviceConfig.Type = "forking";
exec = "${pkgs.oidentd}/sbin/oidentd -u oidentd -g nogroup" + script = "${pkgs.oidentd}/sbin/oidentd -u oidentd -g nogroup" +
optionalString config.networking.enableIPv6 " -a ::" optionalString config.networking.enableIPv6 " -a ::";
;
}; };
users.extraUsers.oidentd = { users.extraUsers.oidentd = {

View File

@ -2,17 +2,7 @@
with lib; with lib;
let
inherit (pkgs) jre openfire coreutils which gnugrep gawk gnused;
extraStartDependency =
if config.services.openfire.usePostgreSQL then "and started postgresql" else "";
in
{ {
###### interface ###### interface
options = { options = {
@ -47,14 +37,13 @@ in
message = "OpenFire assertion failed."; message = "OpenFire assertion failed.";
}; };
jobs.openfire = systemd.services.openfire = {
{ description = "OpenFire XMPP server"; description = "OpenFire XMPP server";
wantedBy = [ "multi-user.target" ];
startOn = "started networking ${extraStartDependency}"; after = [ "networking.target" ] ++
optional config.services.openfire.usePostgreSQL "postgresql.service";
script = path = with pkgs; [ jre openfire coreutils which gnugrep gawk gnused ];
'' script = ''
export PATH=${jre}/bin:${openfire}/bin:${coreutils}/bin:${which}/bin:${gnugrep}/bin:${gawk}/bin:${gnused}/bin
export HOME=/tmp export HOME=/tmp
mkdir /var/log/openfire || true mkdir /var/log/openfire || true
mkdir /etc/openfire || true mkdir /etc/openfire || true
@ -66,7 +55,6 @@ in
openfire start openfire start
''; # */ ''; # */
}; };
}; };
} }

View File

@ -83,21 +83,14 @@ in
gid = config.ids.gids.prayer; gid = config.ids.gids.prayer;
}; };
jobs.prayer = systemd.services.prayer = {
{ name = "prayer"; wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "forking";
startOn = "startup"; preStart = ''
preStart =
''
mkdir -m 0755 -p ${stateDir} mkdir -m 0755 -p ${stateDir}
chown ${prayerUser}.${prayerGroup} ${stateDir} chown ${prayerUser}.${prayerGroup} ${stateDir}
''; '';
script = "${prayer}/sbin/prayer --config-file=${prayerCfg}";
daemonType = "daemon";
exec = "${prayer}/sbin/prayer --config-file=${prayerCfg}";
}; };
}; };
} }

View File

@ -33,16 +33,14 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.pythonPackages.radicale ]; environment.systemPackages = [ pkgs.pythonPackages.radicale ];
jobs.radicale = { systemd.services.radicale = {
description = "A Simple Calendar and Contact Server"; description = "A Simple Calendar and Contact Server";
startOn = "started network-interfaces"; after = [ "network-interfaces.target" ];
exec = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d"; wantedBy = [ "multi-user.target" ];
daemonType = "fork"; script = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d";
serviceConfig.Type = "forking";
}; };
}; };
} }

View File

@ -61,9 +61,10 @@ in
dataDir = cfg.dataDir; dataDir = cfg.dataDir;
})) }))
]; ];
jobs.softether = { systemd.services.softether = {
description = "SoftEther VPN services initial job"; description = "SoftEther VPN services initial job";
startOn = "started network-interfaces"; after = [ "network-interfaces.target" ];
wantedBy = [ "multi-user.target" ];
preStart = '' preStart = ''
for d in vpnserver vpnbridge vpnclient vpncmd; do for d in vpnserver vpnbridge vpnclient vpncmd; do
if ! test -e ${cfg.dataDir}/$d; then if ! test -e ${cfg.dataDir}/$d; then
@ -74,7 +75,6 @@ in
rm -rf ${cfg.dataDir}/vpncmd/vpncmd rm -rf ${cfg.dataDir}/vpncmd/vpncmd
ln -s ${pkg}${cfg.dataDir}/vpncmd/vpncmd ${cfg.dataDir}/vpncmd/vpncmd ln -s ${pkg}${cfg.dataDir}/vpncmd/vpncmd ${cfg.dataDir}/vpncmd/vpncmd
''; '';
exec = "true";
}; };
} }

View File

@ -117,17 +117,18 @@ in
services.lshd.subsystems = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ]; services.lshd.subsystems = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ];
jobs.lshd = systemd.services.lshd = {
{ description = "GNU lshd SSH2 daemon"; description = "GNU lshd SSH2 daemon";
startOn = "started network-interfaces"; after = [ "network-interfaces.target" ];
stopOn = "stopping network-interfaces";
environment = wantedBy = [ "multi-user.target" ];
{ LD_LIBRARY_PATH = config.system.nssModules.path; };
preStart = environment = {
'' LD_LIBRARY_PATH = config.system.nssModules.path;
};
preStart = ''
test -d /etc/lsh || mkdir -m 0755 -p /etc/lsh test -d /etc/lsh || mkdir -m 0755 -p /etc/lsh
test -d /var/spool/lsh || mkdir -m 0755 -p /var/spool/lsh test -d /var/spool/lsh || mkdir -m 0755 -p /var/spool/lsh
@ -147,8 +148,7 @@ in
fi fi
''; '';
exec = with cfg; script = with cfg; ''
''
${lsh}/sbin/lshd --daemonic \ ${lsh}/sbin/lshd --daemonic \
--password-helper="${lsh}/sbin/lsh-pam-checkpw" \ --password-helper="${lsh}/sbin/lsh-pam-checkpw" \
-p ${toString portNumber} \ -p ${toString portNumber} \
@ -172,7 +172,5 @@ in
}; };
security.pam.services.lshd = {}; security.pam.services.lshd = {};
}; };
} }

View File

@ -35,11 +35,11 @@ in
description = "tcpcrypt daemon user"; description = "tcpcrypt daemon user";
}; };
jobs.tcpcrypt = { systemd.services.tcpcrypt = {
description = "tcpcrypt"; description = "tcpcrypt";
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
after = ["network-interfaces.target"]; after = [ "network-interfaces.target" ];
path = [ pkgs.iptables pkgs.tcpcrypt pkgs.procps ]; path = [ pkgs.iptables pkgs.tcpcrypt pkgs.procps ];
@ -58,7 +58,7 @@ in
iptables -t mangle -I POSTROUTING -j nixos-tcpcrypt iptables -t mangle -I POSTROUTING -j nixos-tcpcrypt
''; '';
exec = "tcpcryptd -x 0x10"; script = "tcpcryptd -x 0x10";
postStop = '' postStop = ''
if [ -f /run/pre-tcpcrypt-ecn-state ]; then if [ -f /run/pre-tcpcrypt-ecn-state ]; then

View File

@ -25,17 +25,13 @@ with lib;
environment.systemPackages = [pkgs.wicd]; environment.systemPackages = [pkgs.wicd];
jobs.wicd = systemd.services.wicd = {
{ startOn = "started network-interfaces"; after = [ "network-interfaces.target" ];
stopOn = "stopping network-interfaces"; wantedBy = [ "multi-user.target" ];
script = "${pkgs.wicd}/sbin/wicd -f";
script =
"${pkgs.wicd}/sbin/wicd -f";
}; };
services.dbus.enable = true; services.dbus.enable = true;
services.dbus.packages = [pkgs.wicd]; services.dbus.packages = [pkgs.wicd];
}; };
} }

View File

@ -6,8 +6,6 @@ let
cfg = config.services.xinetd; cfg = config.services.xinetd;
inherit (pkgs) xinetd;
configFile = pkgs.writeText "xinetd.conf" configFile = pkgs.writeText "xinetd.conf"
'' ''
defaults defaults
@ -141,18 +139,12 @@ in
###### implementation ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.xinetd = {
jobs.xinetd = description = "xinetd server";
{ description = "xinetd server"; after = [ "network-interfaces.target" ];
wantedBy = [ "multi-user.target" ];
startOn = "started network-interfaces"; path = [ pkgs.xinetd ];
stopOn = "stopping network-interfaces"; script = "xinetd -syslog daemon -dontfork -stayalive -f ${configFile}";
path = [ xinetd ];
exec = "xinetd -syslog daemon -dontfork -stayalive -f ${configFile}";
}; };
}; };
} }

View File

@ -66,15 +66,15 @@ in
gid = config.ids.gids.atd; gid = config.ids.gids.atd;
}; };
jobs.atd = systemd.services.atd = {
{ description = "Job Execution Daemon (atd)"; description = "Job Execution Daemon (atd)";
after = [ "systemd-udev-settle.service" ];
startOn = "stopped udevtrigger"; wants = [ "systemd-udev-settle.service" ];
wantedBy = [ "multi-user.target" ];
path = [ at ]; path = [ at ];
preStart = preStart = ''
''
# Snippets taken and adapted from the original `install' rule of # Snippets taken and adapted from the original `install' rule of
# the makefile. # the makefile.
@ -104,11 +104,9 @@ in
fi fi
''; '';
exec = "atd"; script = "atd";
daemonType = "fork"; serviceConfig.Type = "forking";
}; };
}; };
} }

View File

@ -108,29 +108,25 @@ in
security.setuidPrograms = [ "fcrontab" ]; security.setuidPrograms = [ "fcrontab" ];
jobs.fcron = systemd.services.fcron = {
{ description = "fcron daemon"; description = "fcron daemon";
startOn = "startup";
after = [ "local-fs.target" ]; after = [ "local-fs.target" ];
wantedBy = [ "multi-user.target" ];
environment = # FIXME use specific path
{ PATH = "/run/current-system/sw/bin"; environment = {
PATH = "/run/current-system/sw/bin";
}; };
preStart = preStart = ''
''
${pkgs.coreutils}/bin/mkdir -m 0700 -p /var/spool/fcron ${pkgs.coreutils}/bin/mkdir -m 0700 -p /var/spool/fcron
# load system crontab file # load system crontab file
${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab} ${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab}
''; '';
daemonType = "fork"; serviceConfig.Type = "forking";
exec = "${pkgs.fcron}/sbin/fcron -m ${toString cfg.maxSerialJobs} ${queuelen}"; script = "${pkgs.fcron}/sbin/fcron -m ${toString cfg.maxSerialJobs} ${queuelen}";
}; };
}; };
} }

View File

@ -67,10 +67,12 @@ in {
services.cron.systemCronJobs = [ "*/${toString cfg.updater.frequency} * * * * root start fprot-updater" ]; services.cron.systemCronJobs = [ "*/${toString cfg.updater.frequency} * * * * root start fprot-updater" ];
jobs = { systemd.services."fprot-updater" = {
fprot_updater = { serviceConfig = {
name = "fprot-updater"; Type = "oneshot";
task = true; RemainAfterExit = false;
};
wantedBy = [ "multi-user.target" ];
# have to copy fpupdate executable because it insists on storing the virus database in the same dir # have to copy fpupdate executable because it insists on storing the virus database in the same dir
preStart = '' preStart = ''
@ -79,12 +81,8 @@ in {
cp ${pkgs.fprot}/opt/f-prot/fpupdate ${stateDir} cp ${pkgs.fprot}/opt/f-prot/fpupdate ${stateDir}
ln -sf ${cfg.updater.productData} ${stateDir}/product.data ln -sf ${cfg.updater.productData} ${stateDir}/product.data
''; '';
#setuid = fprotUser;
#setgid = fprotGroup;
exec = "/var/lib/fprot/fpupdate --keyfile ${cfg.updater.licenseKeyfile}";
};
};
script = "/var/lib/fprot/fpupdate --keyfile ${cfg.updater.licenseKeyfile}";
};
}; };
} }

View File

@ -45,26 +45,19 @@ in
serverArgs = "${pkgs.heimdal}/sbin/kadmind"; serverArgs = "${pkgs.heimdal}/sbin/kadmind";
}; };
jobs.kdc = systemd.services.kdc = {
{ description = "Kerberos Domain Controller daemon"; description = "Kerberos Domain Controller daemon";
wantedBy = [ "multi-user.target" ];
startOn = "ip-up"; preStart = ''
preStart =
''
mkdir -m 0755 -p ${stateDir} mkdir -m 0755 -p ${stateDir}
''; '';
script = "${heimdal}/sbin/kdc";
exec = "${heimdal}/sbin/kdc";
}; };
jobs.kpasswdd = systemd.services.kpasswdd = {
{ description = "Kerberos Domain Controller daemon"; description = "Kerberos Domain Controller daemon";
wantedBy = [ "multi-user.target" ];
startOn = "ip-up"; script = "${heimdal}/sbin/kpasswdd";
exec = "${heimdal}/sbin/kpasswdd";
}; };
}; };

View File

@ -45,13 +45,11 @@ in
home = stateDir; home = stateDir;
}; };
jobs.uptimed = systemd.services.uptimed = {
{ description = "Uptimed daemon"; description = "Uptimed daemon";
wantedBy = [ "multi-user.target" ];
startOn = "startup"; preStart = ''
preStart =
''
mkdir -m 0755 -p ${stateDir} mkdir -m 0755 -p ${stateDir}
chown ${uptimedUser} ${stateDir} chown ${uptimedUser} ${stateDir}
@ -60,7 +58,7 @@ in
fi fi
''; '';
exec = "${uptimed}/sbin/uptimed"; script = "${uptimed}/sbin/uptimed";
}; };
}; };

View File

@ -71,13 +71,10 @@ in
###### implementation ###### implementation
config = mkIf config.services.jboss.enable { config = mkIf config.services.jboss.enable {
systemd.services.jboss = {
jobs.jboss = description = "JBoss server";
{ description = "JBoss server"; script = "${jbossService}/bin/control start";
wantedBy = [ "multi-user.target" ];
exec = "${jbossService}/bin/control start";
}; };
}; };
} }

View File

@ -127,16 +127,13 @@ in
extraGroups = cfg.extraGroups; extraGroups = cfg.extraGroups;
}; };
jobs.tomcat = systemd.services.tomcat = {
{ description = "Apache Tomcat server"; description = "Apache Tomcat server";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
serviceConfig.Type = "daemon";
startOn = "started network-interfaces"; preStart = ''
stopOn = "stopping network-interfaces";
daemonType = "daemon";
preStart =
''
# Create the base directory # Create the base directory
mkdir -p ${cfg.baseDir} mkdir -p ${cfg.baseDir}
@ -349,8 +346,7 @@ in
${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh' ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh'
''; '';
postStop = postStop = ''
''
echo "Stopping tomcat..." echo "Stopping tomcat..."
CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh
''; '';

View File

@ -30,20 +30,17 @@ in
###### implementation ###### implementation
config = mkIf config.services.xfs.enable { config = mkIf config.services.xfs.enable {
assertions = singleton assertions = singleton
{ assertion = config.fonts.enableFontDir; { assertion = config.fonts.enableFontDir;
message = "Please enable fonts.enableFontDir to use the X Font Server."; message = "Please enable fonts.enableFontDir to use the X Font Server.";
}; };
jobs.xfs = systemd.services.xfs = {
{ description = "X Font Server"; description = "X Font Server";
after = [ "network.target" ];
startOn = "started networking"; wantedBy = [ "multi-user.target" ];
path = [ pkgs.xorg.xfs ];
exec = "${pkgs.xorg.xfs}/bin/xfs -config ${configFile}"; script = "xfs -config ${configFile}";
}; };
}; };
} }

View File

@ -1,290 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
with import ../boot/systemd-unit-options.nix { inherit config lib; };
let
userExists = u:
(u == "") || any (uu: uu.name == u) (attrValues config.users.extraUsers);
groupExists = g:
(g == "") || any (gg: gg.name == g) (attrValues config.users.extraGroups);
makeJobScript = name: content: "${pkgs.writeScriptBin name content}/bin/${name}";
# From a job description, generate an systemd unit file.
makeUnit = job:
let
hasMain = job.script != "" || job.exec != "";
env = job.environment;
preStartScript = makeJobScript "${job.name}-pre-start"
''
#! ${pkgs.stdenv.shell} -e
${job.preStart}
'';
startScript = makeJobScript "${job.name}-start"
''
#! ${pkgs.stdenv.shell} -e
${if job.script != "" then job.script else ''
exec ${job.exec}
''}
'';
postStartScript = makeJobScript "${job.name}-post-start"
''
#! ${pkgs.stdenv.shell} -e
${job.postStart}
'';
preStopScript = makeJobScript "${job.name}-pre-stop"
''
#! ${pkgs.stdenv.shell} -e
${job.preStop}
'';
postStopScript = makeJobScript "${job.name}-post-stop"
''
#! ${pkgs.stdenv.shell} -e
${job.postStop}
'';
in {
inherit (job) description requires before partOf environment path restartIfChanged unitConfig;
after =
(if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else
if job.startOn == "started udev" then [ "systemd-udev.service" ] else
if job.startOn == "started network-interfaces" then [ "network-interfaces.target" ] else
if job.startOn == "started networking" then [ "network.target" ] else
if job.startOn == "ip-up" then [] else
if job.startOn == "" || job.startOn == "startup" then [] else
builtins.trace "Warning: job ${job.name} has unknown startOn value ${job.startOn}." []
) ++ job.after;
wants =
(if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else []
) ++ job.wants;
wantedBy =
(if job.startOn == "" then [] else
if job.startOn == "ip-up" then [ "ip-up.target" ] else
[ "multi-user.target" ]) ++ job.wantedBy;
serviceConfig =
job.serviceConfig
// optionalAttrs (job.preStart != "" && (job.script != "" || job.exec != ""))
{ ExecStartPre = preStartScript; }
// optionalAttrs (job.preStart != "" && job.script == "" && job.exec == "")
{ ExecStart = preStartScript; }
// optionalAttrs (job.script != "" || job.exec != "")
{ ExecStart = startScript; }
// optionalAttrs (job.postStart != "")
{ ExecStartPost = postStartScript; }
// optionalAttrs (job.preStop != "")
{ ExecStop = preStopScript; }
// optionalAttrs (job.postStop != "")
{ ExecStopPost = postStopScript; }
// (if job.script == "" && job.exec == "" then { Type = "oneshot"; RemainAfterExit = true; } else
if job.daemonType == "fork" || job.daemonType == "daemon" then { Type = "forking"; GuessMainPID = true; } else
if job.daemonType == "none" then { } else
throw "invalid daemon type `${job.daemonType}'")
// optionalAttrs (!job.task && !(job.script == "" && job.exec == "") && job.respawn)
{ Restart = "always"; }
// optionalAttrs job.task
{ Type = "oneshot"; RemainAfterExit = false; };
};
jobOptions = serviceOptions // {
name = mkOption {
# !!! The type should ensure that this could be a filename.
type = types.str;
example = "sshd";
description = ''
Name of the job, mapped to the systemd unit
<literal><replaceable>name</replaceable>.service</literal>.
'';
};
startOn = mkOption {
#type = types.str;
default = "";
description = ''
The Upstart event that triggers this job to be started. Some
are mapped to systemd dependencies; otherwise you will get a
warning. If empty, the job will not start automatically.
'';
};
stopOn = mkOption {
type = types.str;
default = "starting shutdown";
description = ''
Ignored; this was the Upstart event that triggers this job to be stopped.
'';
};
postStart = mkOption {
type = types.lines;
default = "";
description = ''
Shell commands executed after the job is started (i.e. after
the job's main process is started), but before the job is
considered running.
'';
};
preStop = mkOption {
type = types.lines;
default = "";
description = ''
Shell commands executed before the job is stopped
(i.e. before systemd kills the job's main process). This can
be used to cleanly shut down a daemon.
'';
};
postStop = mkOption {
type = types.lines;
default = "";
description = ''
Shell commands executed after the job has stopped
(i.e. after the job's main process has terminated).
'';
};
exec = mkOption {
type = types.str;
default = "";
description = ''
Command to start the job's main process. If empty, the
job has no main process, but can still have pre/post-start
and pre/post-stop scripts, and is considered running
until it is stopped.
'';
};
respawn = mkOption {
type = types.bool;
default = true;
description = ''
Whether to restart the job automatically if its process
ends unexpectedly.
'';
};
task = mkOption {
type = types.bool;
default = false;
description = ''
Whether this job is a task rather than a service. Tasks
are executed only once, while services are restarted when
they exit.
'';
};
daemonType = mkOption {
type = types.str;
default = "none";
description = ''
Determines how systemd detects when a daemon should be
considered running. The value <literal>none</literal> means
that the daemon is considered ready immediately. The value
<literal>fork</literal> means that the daemon will fork once.
The value <literal>daemon</literal> means that the daemon will
fork twice. The value <literal>stop</literal> means that the
daemon will raise the SIGSTOP signal to indicate readiness.
'';
};
setuid = mkOption {
type = types.addCheck types.str userExists;
default = "";
description = ''
Run the daemon as a different user.
'';
};
setgid = mkOption {
type = types.addCheck types.str groupExists;
default = "";
description = ''
Run the daemon as a different group.
'';
};
path = mkOption {
default = [];
description = ''
Packages added to the job's <envar>PATH</envar> environment variable.
Both the <filename>bin</filename> and <filename>sbin</filename>
subdirectories of each package are added.
'';
};
};
upstartJob = { name, config, ... }: {
options = {
unit = mkOption {
default = makeUnit config;
description = "Generated definition of the systemd unit corresponding to this job.";
};
};
config = {
# The default name is the name extracted from the attribute path.
name = mkDefault name;
};
};
in
{
###### interface
options = {
jobs = mkOption {
default = {};
description = ''
This option is a legacy method to define system services,
dating from the era where NixOS used Upstart instead of
systemd. You should use <option>systemd.services</option>
instead. Services defined using <option>jobs</option> are
mapped automatically to <option>systemd.services</option>, but
may not work perfectly; in particular, most
<option>startOn</option> conditions are not supported.
'';
type = types.loaOf types.optionSet;
options = [ jobOptions upstartJob ];
};
};
###### implementation
config = {
systemd.services =
flip mapAttrs' config.jobs (name: job:
nameValuePair job.name job.unit);
};
}

View File

@ -31,13 +31,5 @@ in
'' ''
btrfs device scan btrfs device scan
''; '';
# !!! This is broken. There should be a udev rule to do this when
# new devices are discovered.
jobs.udev.postStart =
''
${pkgs.btrfs-progs}/bin/btrfs device scan
'';
}; };
} }

View File

@ -166,8 +166,8 @@ in
''; '';
}; };
jobs."libvirt-guests" = systemd.services."libvirt-guests" = {
{ description = "Libvirt Virtual Machines"; description = "Libvirt Virtual Machines";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "libvirtd.service" ]; wants = [ "libvirtd.service" ];
@ -175,23 +175,23 @@ in
restartIfChanged = false; restartIfChanged = false;
path = [ pkgs.gettext pkgs.libvirt pkgs.gawk ]; path = with pkgs; [ gettext libvirt gawk ];
preStart = preStart = ''
''
mkdir -p /var/lock/subsys -m 755 mkdir -p /var/lock/subsys -m 755
${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests start || true ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests start || true
''; '';
postStop = postStop = ''
''
export PATH=${pkgs.gettext}/bin:$PATH export PATH=${pkgs.gettext}/bin:$PATH
export ON_SHUTDOWN=${cfg.onShutdown} export ON_SHUTDOWN=${cfg.onShutdown}
${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop
''; '';
serviceConfig.Type = "oneshot"; serviceConfig = {
serviceConfig.RemainAfterExit = true; Type = "oneshot";
RemainAfterExit = true;
};
}; };
users.extraGroups.libvirtd.gid = config.ids.gids.libvirtd; users.extraGroups.libvirtd.gid = config.ids.gids.libvirtd;

View File

@ -34,9 +34,9 @@ rec {
{ server = { server =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ jobs."quake3-server" = { systemd.services."quake3-server" =
{ startOn = "startup"; { wantedBy = [ "multi-user.target" ];
exec = script =
"${pkgs.quake3demo}/bin/quake3-server '+set g_gametype 0' " + "${pkgs.quake3demo}/bin/quake3-server '+set g_gametype 0' " +
"'+map q3dm7' '+addbot grunt' '+addbot daemia' 2> /tmp/log"; "'+map q3dm7' '+addbot grunt' '+addbot daemia' 2> /tmp/log";
}; };

View File

@ -1,56 +0,0 @@
{stdenv, fetchurl, pkgconfig, pcre, libxml2, sqlite, ffmpeg, imagemagick,
exiv2, mp4v2, lame, libvorbis, flac, libmad, faad2}:
stdenv.mkDerivation rec {
name = "fuppes-0.660";
src = fetchurl {
url = mirror://sourceforge/project/fuppes/fuppes/SVN-660/fuppes-0.660.tar.gz;
sha256 = "1c385b29878927e5f1e55ae2c9ad284849d1522d9517a88e34feb92bd5195173";
};
patches = [
./fuppes-faad-exanpse-backward-symbols-macro.patch
];
buildInputs = [
pkgconfig pcre libxml2 sqlite ffmpeg imagemagick exiv2 mp4v2 lame
libvorbis flac libmad faad2
];
configureFlags = [
"--enable-ffmpegthumbnailer"
"--enable-magickwand"
"--enable-exiv2"
"--enable-transcoder-ffmpeg"
"--enable-mp4v2"
"--enable-lame"
"--enable-vorbis"
"--enable-flac"
"--enable-mad"
"--enable-faad"
];
postFixup = ''
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/fuppes):${faad2}/lib" $out/bin/fuppes
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/fuppesd):${faad2}/lib" $out/bin/fuppesd
'';
meta = {
description = "UPnP A/V Media Server";
longDescription = ''
FUPPES is a free, multiplatform UPnP A/V Media Server.
FUPPES supports a wide range of UPnP MediaRenderers as well as
on-the-fly transcoding of various audio, video and image formats.
FUPPES also includes basic DLNA support.
'';
homepage = http://fuppes.ulrich-voelkel.de/;
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.pierron ];
platforms = stdenv.lib.platforms.all;
broken = true;
};
}

View File

@ -1,91 +0,0 @@
diff -x _inst -x _build -x .svn -ur fuppes-0.660/src/lib/Transcoding/FaadWrapper.cpp fuppes-0.660.new/src/lib/Transcoding/FaadWrapper.cpp
--- fuppes-0.660/src/lib/Transcoding/FaadWrapper.cpp 2009-11-19 10:16:25.000000000 +0100
+++ fuppes-0.660.new/src/lib/Transcoding/FaadWrapper.cpp 2011-01-30 22:25:34.171263052 +0100
@@ -329,13 +329,19 @@
CloseFile();
}
-
+
+// These macros are used to convert old function names to new ones based on
+// the #define declared in faad headers. The two-level macro are used to
+// expanse the macro which are gave to to_str.
+#define to_str_(fun) #fun
+#define to_str(fun) to_str_(fun)
+
bool CFaadWrapper::LoadLib()
{
#ifdef WIN32
- std::string sLibName = "libfaad-0.dll";
+ std::string sLibName = "libfaad-2.dll";
#else
- std::string sLibName = "libfaad.so.0";
+ std::string sLibName = "libfaad.so.2";
#endif
if(!CSharedConfig::Shared()->FaadLibName().empty()) {
@@ -350,54 +356,54 @@
return false;
}
- m_faacDecOpen = (faacDecOpen_t)FuppesGetProcAddress(m_LibHandle, "faacDecOpen");
+ m_faacDecOpen = (faacDecOpen_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecOpen));
if(!m_faacDecOpen) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecOpen'", __FILE__, __LINE__);
return false;
}
- m_faacDecGetErrorMessage = (faacDecGetErrorMessage_t)FuppesGetProcAddress(m_LibHandle, "faacDecGetErrorMessage");
+ m_faacDecGetErrorMessage = (faacDecGetErrorMessage_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecGetErrorMessage));
if(!m_faacDecGetErrorMessage) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecGetErrorMessage'", __FILE__, __LINE__);
return false;
}
- m_faacDecGetCurrentConfiguration = (faacDecGetCurrentConfiguration_t)FuppesGetProcAddress(m_LibHandle, "faacDecGetCurrentConfiguration");
+ m_faacDecGetCurrentConfiguration = (faacDecGetCurrentConfiguration_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecGetCurrentConfiguration));
if(!m_faacDecGetCurrentConfiguration) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecGetCurrentConfiguration'", __FILE__, __LINE__);
}
- m_faacDecSetConfiguration = (faacDecSetConfiguration_t)FuppesGetProcAddress(m_LibHandle, "faacDecSetConfiguration");
+ m_faacDecSetConfiguration = (faacDecSetConfiguration_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecSetConfiguration));
if(!m_faacDecSetConfiguration) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecSetConfiguration'", __FILE__, __LINE__);
}
- m_faacDecInit = (faacDecInit_t)FuppesGetProcAddress(m_LibHandle, "faacDecInit");
+ m_faacDecInit = (faacDecInit_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecInit));
if(!m_faacDecInit) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecInit'", __FILE__, __LINE__);
}
- m_faacDecInit2 = (faacDecInit2_t)FuppesGetProcAddress(m_LibHandle, "faacDecInit2");
+ m_faacDecInit2 = (faacDecInit2_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecInit2));
if(!m_faacDecInit2) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecInit2'", __FILE__, __LINE__);
return false;
}
- m_faacDecDecode = (faacDecDecode_t)FuppesGetProcAddress(m_LibHandle, "faacDecDecode");
+ m_faacDecDecode = (faacDecDecode_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecDecode));
if(!m_faacDecDecode) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecDecode'", __FILE__, __LINE__);
return false;
}
- m_faacDecClose = (faacDecClose_t)FuppesGetProcAddress(m_LibHandle, "faacDecClose");
+ m_faacDecClose = (faacDecClose_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecClose));
if(!m_faacDecClose) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol 'faacDecClose'", __FILE__, __LINE__);
return false;
}
- m_AudioSpecificConfig = (AudioSpecificConfig_t)FuppesGetProcAddress(m_LibHandle, "AudioSpecificConfig");
+ m_AudioSpecificConfig = (AudioSpecificConfig_t)FuppesGetProcAddress(m_LibHandle, to_str(AudioSpecificConfig));
if(!m_AudioSpecificConfig) {
- m_AudioSpecificConfig = (AudioSpecificConfig_t)FuppesGetProcAddress(m_LibHandle, "faacDecAudioSpecificConfig");
+ m_AudioSpecificConfig = (AudioSpecificConfig_t)FuppesGetProcAddress(m_LibHandle, to_str(faacDecAudioSpecificConfig));
if(!m_AudioSpecificConfig) {
CSharedLog::Shared()->Log(L_EXT, "cannot load symbol '(faacDec)AudioSpecificConfig'", __FILE__, __LINE__);
return false;

View File

@ -1564,8 +1564,6 @@ let
ftop = callPackage ../os-specific/linux/ftop { }; ftop = callPackage ../os-specific/linux/ftop { };
fuppes = callPackage ../tools/networking/fuppes { };
fsfs = callPackage ../tools/filesystems/fsfs { }; fsfs = callPackage ../tools/filesystems/fsfs { };
fuseiso = callPackage ../tools/filesystems/fuseiso { }; fuseiso = callPackage ../tools/filesystems/fuseiso { };