jobs -> systemd.services

+752 -1204
+1 -2
nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
··· 149 149 # not be started by default on the installation CD because the 150 150 # default root password is empty. 151 151 services.openssh.enable = true; 152 - 153 - jobs.openssh.startOn = lib.mkOverride 50 ""; 152 + systemd.services.openssh.wantedBy = lib.mkOverride 50 []; 154 153 155 154 boot.loader.grub.enable = false; 156 155 boot.loader.generationsDir.enable = false;
+1 -1
nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
··· 164 164 # not be started by default on the installation CD because the 165 165 # default root password is empty. 166 166 services.openssh.enable = true; 167 - jobs.openssh.startOn = lib.mkOverride 50 ""; 167 + systemd.services.openssh.wantedBy = lib.mkOverride 50 []; 168 168 169 169 # cpufrequtils fails to build on non-pc 170 170 powerManagement.enable = false;
-1
nixos/modules/module-list.nix
··· 475 475 ./system/boot/timesyncd.nix 476 476 ./system/boot/tmp.nix 477 477 ./system/etc/etc.nix 478 - ./system/upstart/upstart.nix 479 478 ./tasks/bcache.nix 480 479 ./tasks/cpu-freq.nix 481 480 ./tasks/encrypted-devices.nix
+3 -5
nixos/modules/services/databases/4store-endpoint.nix
··· 60 60 61 61 services.avahi.enable = true; 62 62 63 - jobs.fourStoreEndpoint = { 64 - name = "4store-endpoint"; 65 - startOn = "ip-up"; 66 - 67 - exec = '' 63 + systemd.services."4store-endpoint" = { 64 + wantedBy = [ "ip-up.target" ]; 65 + script = '' 68 66 ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}' 69 67 ''; 70 68 };
+3 -6
nixos/modules/services/databases/4store.nix
··· 52 52 53 53 services.avahi.enable = true; 54 54 55 - jobs.fourStore = { 56 - name = "4store"; 57 - startOn = "ip-up"; 55 + systemd.services."4store" = { 56 + wantedBy = [ "ip-up.target" ]; 58 57 59 58 preStart = '' 60 59 mkdir -p ${stateDir}/ ··· 64 63 fi 65 64 ''; 66 65 67 - exec = '' 66 + script = '' 68 67 ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}' 69 68 ''; 70 69 }; 71 - 72 70 }; 73 - 74 71 }
+12 -13
nixos/modules/services/databases/virtuoso.nix
··· 29 29 }; 30 30 31 31 listenAddress = mkOption { 32 - default = "1111"; 33 - example = "myserver:1323"; 32 + default = "1111"; 33 + example = "myserver:1323"; 34 34 description = "ip:port or port to listen on."; 35 35 }; 36 36 37 37 httpListenAddress = mkOption { 38 - default = null; 39 - example = "myserver:8080"; 38 + default = null; 39 + example = "myserver:8080"; 40 40 description = "ip:port or port for Virtuoso HTTP server to listen on."; 41 41 }; 42 42 43 43 dirsAllowed = mkOption { 44 - default = null; 45 - example = "/www, /home/"; 44 + default = null; 45 + example = "/www, /home/"; 46 46 description = "A list of directories Virtuoso is allowed to access"; 47 47 }; 48 48 }; ··· 61 61 home = stateDir; 62 62 }; 63 63 64 - jobs.virtuoso = { 65 - name = "virtuoso"; 66 - startOn = "ip-up"; 64 + systemd.services.virtuoso = { 65 + wantedBy = [ "ip-up.target" ]; 67 66 68 67 preStart = '' 69 - mkdir -p ${stateDir} 70 - chown ${virtuosoUser} ${stateDir} 68 + mkdir -p ${stateDir} 69 + chown ${virtuosoUser} ${stateDir} 71 70 ''; 72 71 73 72 script = '' 74 - cd ${stateDir} 75 - ${pkgs.virtuoso}/bin/virtuoso-t +foreground +configfile ${pkgs.writeText "virtuoso.ini" cfg.config} 73 + cd ${stateDir} 74 + ${pkgs.virtuoso}/bin/virtuoso-t +foreground +configfile ${pkgs.writeText "virtuoso.ini" cfg.config} 76 75 ''; 77 76 }; 78 77
+2 -2
nixos/modules/services/games/ghost-one.nix
··· 78 78 bot_replaypath = replays 79 79 ''; 80 80 81 - jobs.ghostOne = { 82 - name = "ghost-one"; 81 + systemd.services."ghost-one" = { 82 + wantedBy = [ "multi-user.target" ]; 83 83 script = '' 84 84 mkdir -p ${stateDir} 85 85 cd ${stateDir}
+14 -10
nixos/modules/services/hardware/acpid.nix
··· 98 98 99 99 config = mkIf config.services.acpid.enable { 100 100 101 - jobs.acpid = 102 - { description = "ACPI Daemon"; 103 - 104 - wantedBy = [ "multi-user.target" ]; 105 - after = [ "systemd-udev-settle.service" ]; 101 + systemd.services.acpid = { 102 + description = "ACPI Daemon"; 106 103 107 - path = [ pkgs.acpid ]; 104 + wantedBy = [ "multi-user.target" ]; 105 + after = [ "systemd-udev-settle.service" ]; 108 106 109 - daemonType = "fork"; 107 + path = [ pkgs.acpid ]; 110 108 111 - exec = "acpid --confdir ${acpiConfDir}"; 109 + serviceConfig = { 110 + Type = "forking"; 111 + }; 112 112 113 - unitConfig.ConditionVirtualization = "!systemd-nspawn"; 114 - unitConfig.ConditionPathExists = [ "/proc/acpi" ]; 113 + unitConfig = { 114 + ConditionVirtualization = "!systemd-nspawn"; 115 + ConditionPathExists = [ "/proc/acpi" ]; 115 116 }; 117 + 118 + script = "acpid --confdir ${acpiConfDir}"; 119 + }; 116 120 117 121 }; 118 122
+5 -10
nixos/modules/services/hardware/pommed.nix
··· 35 35 36 36 services.dbus.packages = [ pkgs.pommed ]; 37 37 38 - jobs.pommed = { name = "pommed"; 39 - 38 + systemd.services.pommed = { 40 39 description = "Pommed hotkey management"; 41 - 42 - startOn = "started dbus"; 43 - 40 + wantedBy = [ "multi-user.target" ]; 41 + after = [ "dbus.service" ]; 44 42 postStop = "rm -f /var/run/pommed.pid"; 45 - 46 - exec = "${pkgs.pommed}/bin/pommed"; 47 - 48 - daemonType = "fork"; 49 - 43 + script = "${pkgs.pommed}/bin/pommed"; 44 + serviceConfig.Type = "forking"; 50 45 path = [ pkgs.eject ]; 51 46 }; 52 47 };
+9 -16
nixos/modules/services/logging/klogd.nix
··· 24 24 ###### implementation 25 25 26 26 config = mkIf config.services.klogd.enable { 27 - 28 - jobs.klogd = 29 - { description = "Kernel Log Daemon"; 30 - 31 - wantedBy = [ "multi-user.target" ]; 32 - 33 - path = [ pkgs.sysklogd ]; 34 - 35 - unitConfig.ConditionVirtualization = "!systemd-nspawn"; 36 - 37 - exec = 38 - "klogd -c 1 -2 -n " + 39 - "-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map"; 40 - }; 41 - 27 + systemd.services.klogd = { 28 + description = "Kernel Log Daemon"; 29 + wantedBy = [ "multi-user.target" ]; 30 + path = [ pkgs.sysklogd ]; 31 + unitConfig.ConditionVirtualization = "!systemd-nspawn"; 32 + script = 33 + "klogd -c 1 -2 -n " + 34 + "-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map"; 35 + }; 42 36 }; 43 - 44 37 }
+9 -8
nixos/modules/services/mail/freepops.nix
··· 72 72 }; 73 73 74 74 config = mkIf cfg.enable { 75 - jobs.freepopsd = { 75 + systemd.services.freepopsd = { 76 76 description = "Freepopsd (webmail over POP3)"; 77 - startOn = "ip-up"; 78 - exec = ''${pkgs.freepops}/bin/freepopsd \ 79 - -p ${toString cfg.port} \ 80 - -t ${toString cfg.threads} \ 81 - -b ${cfg.bind} \ 82 - -vv -l ${cfg.logFile} \ 83 - -s ${cfg.suid.user}.${cfg.suid.group} 77 + wantedBy = [ "ip-up.target" ]; 78 + script = '' 79 + ${pkgs.freepops}/bin/freepopsd \ 80 + -p ${toString cfg.port} \ 81 + -t ${toString cfg.threads} \ 82 + -b ${cfg.bind} \ 83 + -vv -l ${cfg.logFile} \ 84 + -s ${cfg.suid.user}.${cfg.suid.group} 84 85 ''; 85 86 }; 86 87 };
+2 -4
nixos/modules/services/mail/spamassassin.nix
··· 50 50 gid = config.ids.gids.spamd; 51 51 }; 52 52 53 - jobs.spamd = { 53 + systemd.services.spamd = { 54 54 description = "Spam Assassin Server"; 55 55 56 56 wantedBy = [ "multi-user.target" ]; 57 57 after = [ "network.target" ]; 58 58 59 - 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"; 59 + 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"; 60 60 }; 61 - 62 61 }; 63 - 64 62 }
+7 -8
nixos/modules/services/misc/dictd.nix
··· 51 51 gid = config.ids.gids.dictd; 52 52 }; 53 53 54 - jobs.dictd = 55 - { description = "DICT.org Dictionary Server"; 56 - startOn = "startup"; 57 - environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; }; 58 - daemonType = "fork"; 59 - exec = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8"; 60 - }; 54 + systemd.services.dictd = { 55 + description = "DICT.org Dictionary Server"; 56 + wantedBy = [ "multi-user.target" ]; 57 + environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; }; 58 + serviceConfig.Type = "forking"; 59 + script = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8"; 60 + }; 61 61 }; 62 - 63 62 }
+51 -53
nixos/modules/services/misc/disnix.nix
··· 91 91 ( { hostname = config.networking.hostName; 92 92 #targetHost = config.deployment.targetHost; 93 93 system = if config.nixpkgs.system == "" then builtins.currentSystem else config.nixpkgs.system; 94 - 94 + 95 95 supportedTypes = (import "${pkgs.stdenv.mkDerivation { 96 96 name = "supportedtypes"; 97 97 buildCommand = '' ··· 117 117 118 118 services.disnix.publishInfrastructure.enable = cfg.publishAvahi; 119 119 120 - jobs = { 121 - disnix = 122 - { description = "Disnix server"; 123 - 124 - wants = [ "dysnomia.target" ]; 125 - wantedBy = [ "multi-user.target" ]; 126 - after = [ "dbus.service" ] 127 - ++ optional config.services.httpd.enable "httpd.service" 128 - ++ optional config.services.mysql.enable "mysql.service" 129 - ++ optional config.services.postgresql.enable "postgresql.service" 130 - ++ optional config.services.tomcat.enable "tomcat.service" 131 - ++ optional config.services.svnserve.enable "svnserve.service" 132 - ++ optional config.services.mongodb.enable "mongodb.service"; 120 + systemd.services = { 121 + disnix = { 122 + description = "Disnix server"; 123 + wants = [ "dysnomia.target" ]; 124 + wantedBy = [ "multi-user.target" ]; 125 + after = [ "dbus.service" ] 126 + ++ optional config.services.httpd.enable "httpd.service" 127 + ++ optional config.services.mysql.enable "mysql.service" 128 + ++ optional config.services.postgresql.enable "postgresql.service" 129 + ++ optional config.services.tomcat.enable "tomcat.service" 130 + ++ optional config.services.svnserve.enable "svnserve.service" 131 + ++ optional config.services.mongodb.enable "mongodb.service"; 133 132 134 - restartIfChanged = false; 135 - 136 - path = [ pkgs.nix pkgs.disnix dysnomia "/run/current-system/sw" ]; 137 - 138 - environment = { 139 - HOME = "/root"; 140 - }; 141 - 142 - preStart = '' 143 - mkdir -p /etc/systemd-mutable/system 144 - if [ ! -f /etc/systemd-mutable/system/dysnomia.target ] 145 - then 146 - ( echo "[Unit]" 147 - echo "Description=Services that are activated and deactivated by Dysnomia" 148 - echo "After=final.target" 149 - ) > /etc/systemd-mutable/system/dysnomia.target 150 - fi 151 - ''; 133 + restartIfChanged = false; 134 + 135 + path = [ pkgs.nix pkgs.disnix dysnomia "/run/current-system/sw" ]; 152 136 153 - exec = "disnix-service"; 137 + environment = { 138 + HOME = "/root"; 154 139 }; 155 - } // optionalAttrs cfg.publishAvahi { 156 - disnixAvahi = 157 - { description = "Disnix Avahi publisher"; 158 140 159 - startOn = "started avahi-daemon"; 141 + preStart = '' 142 + mkdir -p /etc/systemd-mutable/system 143 + if [ ! -f /etc/systemd-mutable/system/dysnomia.target ] 144 + then 145 + ( echo "[Unit]" 146 + echo "Description=Services that are activated and deactivated by Dysnomia" 147 + echo "After=final.target" 148 + ) > /etc/systemd-mutable/system/dysnomia.target 149 + fi 150 + ''; 160 151 161 - exec = 162 - '' 163 - ${pkgs.avahi}/bin/avahi-publish-service disnix-${config.networking.hostName} _disnix._tcp 22 \ 164 - "mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e 's/MemTotal://' -e 's/ //g')" \ 165 - ${concatMapStrings (infrastructureAttrName: 166 - let infrastructureAttrValue = getAttr infrastructureAttrName (cfg.infrastructure); 167 - in 168 - if isInt infrastructureAttrValue then 169 - ''${infrastructureAttrName}=${toString infrastructureAttrValue} \ 170 - '' 171 - else 172 - ''${infrastructureAttrName}=\"${infrastructureAttrValue}\" \ 173 - '' 174 - ) (attrNames (cfg.infrastructure))} 175 - ''; 176 - }; 152 + script = "disnix-service"; 153 + }; 154 + } // optionalAttrs cfg.publishAvahi { 155 + disnixAvahi = { 156 + description = "Disnix Avahi publisher"; 157 + wants = [ "avahi-daemon.service" ]; 158 + wantedBy = [ "multi-user.target" ]; 159 + 160 + script = '' 161 + ${pkgs.avahi}/bin/avahi-publish-service disnix-${config.networking.hostName} _disnix._tcp 22 \ 162 + "mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e 's/MemTotal://' -e 's/ //g')" \ 163 + ${concatMapStrings (infrastructureAttrName: 164 + let infrastructureAttrValue = getAttr infrastructureAttrName (cfg.infrastructure); 165 + in 166 + if isInt infrastructureAttrValue then 167 + ''${infrastructureAttrName}=${toString infrastructureAttrValue} \ 168 + '' 169 + else 170 + ''${infrastructureAttrName}=\"${infrastructureAttrValue}\" \ 171 + '' 172 + ) (attrNames (cfg.infrastructure))} 173 + ''; 174 + }; 177 175 }; 178 176 }; 179 177 }
+40 -43
nixos/modules/services/misc/felix.nix
··· 57 57 home = "/homeless-shelter"; 58 58 }; 59 59 60 - jobs.felix = 61 - { description = "Felix server"; 60 + systemd.services.felix = { 61 + description = "Felix server"; 62 + wantedBy = [ "multi-user.target" ]; 62 63 63 - preStart = 64 - '' 65 - # Initialise felix instance on first startup 66 - if [ ! -d /var/felix ] 67 - then 68 - # Symlink system files 64 + preStart = '' 65 + # Initialise felix instance on first startup 66 + if [ ! -d /var/felix ] 67 + then 68 + # Symlink system files 69 69 70 - mkdir -p /var/felix 71 - chown ${cfg.user}:${cfg.group} /var/felix 70 + mkdir -p /var/felix 71 + chown ${cfg.user}:${cfg.group} /var/felix 72 72 73 - for i in ${pkgs.felix}/* 74 - do 75 - if [ "$i" != "${pkgs.felix}/bundle" ] 76 - then 77 - ln -sfn $i /var/felix/$(basename $i) 78 - fi 79 - done 73 + for i in ${pkgs.felix}/* 74 + do 75 + if [ "$i" != "${pkgs.felix}/bundle" ] 76 + then 77 + ln -sfn $i /var/felix/$(basename $i) 78 + fi 79 + done 80 80 81 - # Symlink bundles 82 - mkdir -p /var/felix/bundle 83 - chown ${cfg.user}:${cfg.group} /var/felix/bundle 81 + # Symlink bundles 82 + mkdir -p /var/felix/bundle 83 + chown ${cfg.user}:${cfg.group} /var/felix/bundle 84 84 85 - for i in ${pkgs.felix}/bundle/* ${toString cfg.bundles} 86 - do 87 - if [ -f $i ] 88 - then 89 - ln -sfn $i /var/felix/bundle/$(basename $i) 90 - elif [ -d $i ] 91 - then 92 - for j in $i/bundle/* 93 - do 94 - ln -sfn $j /var/felix/bundle/$(basename $j) 95 - done 96 - fi 97 - done 98 - fi 99 - ''; 85 + for i in ${pkgs.felix}/bundle/* ${toString cfg.bundles} 86 + do 87 + if [ -f $i ] 88 + then 89 + ln -sfn $i /var/felix/bundle/$(basename $i) 90 + elif [ -d $i ] 91 + then 92 + for j in $i/bundle/* 93 + do 94 + ln -sfn $j /var/felix/bundle/$(basename $j) 95 + done 96 + fi 97 + done 98 + fi 99 + ''; 100 100 101 - script = 102 - '' 103 - cd /var/felix 104 - ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c '${pkgs.jre}/bin/java -jar bin/felix.jar' 105 - ''; 106 - }; 107 - 101 + script = '' 102 + cd /var/felix 103 + ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c '${pkgs.jre}/bin/java -jar bin/felix.jar' 104 + ''; 105 + }; 108 106 }; 109 - 110 107 }
+13 -19
nixos/modules/services/misc/folding-at-home.nix
··· 49 49 home = stateDir; 50 50 }; 51 51 52 - jobs.foldingAtHome = 53 - { name = "foldingathome"; 54 - 55 - startOn = "started network-interfaces"; 56 - stopOn = "stopping network-interfaces"; 57 - 58 - preStart = 59 - '' 60 - mkdir -m 0755 -p ${stateDir} 61 - chown ${fahUser} ${stateDir} 62 - cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg 63 - ''; 64 - exec = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'"; 65 - }; 66 - 67 - services.foldingAtHome.config = '' 68 - [settings] 69 - username=${cfg.nickname} 52 + systemd.services.foldingathome = { 53 + after = [ "network-interfaces.target" ]; 54 + wantedBy = [ "multi-user.target" ]; 55 + preStart = '' 56 + mkdir -m 0755 -p ${stateDir} 57 + chown ${fahUser} ${stateDir} 58 + cp -f ${pkgs.writeText "client.cfg" cfg.config} ${stateDir}/client.cfg 70 59 ''; 60 + script = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fahUser} -c 'cd ${stateDir}; ${pkgs.foldingathome}/bin/fah6'"; 61 + }; 71 62 63 + services.foldingAtHome.config = '' 64 + [settings] 65 + username=${cfg.nickname} 66 + ''; 72 67 }; 73 - 74 68 }
+4 -6
nixos/modules/services/misc/svnserve.nix
··· 34 34 ###### implementation 35 35 36 36 config = mkIf cfg.enable { 37 - jobs.svnserve = { 38 - startOn = "started network-interfaces"; 39 - stopOn = "stopping network-interfaces"; 40 - 37 + systemd.services.svnserve = { 38 + after = [ "network-interfaces.target" ]; 39 + wantedBy = [ "multi-user.target" ]; 41 40 preStart = "mkdir -p ${cfg.svnBaseDir}"; 42 - 43 - exec = "${pkgs.subversion}/bin/svnserve -r ${cfg.svnBaseDir} -d --foreground --pid-file=/var/run/svnserve.pid"; 41 + script = "${pkgs.subversion}/bin/svnserve -r ${cfg.svnBaseDir} -d --foreground --pid-file=/var/run/svnserve.pid"; 44 42 }; 45 43 }; 46 44 }
+5 -11
nixos/modules/services/monitoring/monit.nix
··· 19 19 default = ""; 20 20 description = "monit.conf content"; 21 21 }; 22 - startOn = mkOption { 23 - default = "started network-interfaces"; 24 - description = "What Monit supposes to be already present"; 25 - }; 26 22 }; 27 23 }; 28 24 ··· 39 35 } 40 36 ]; 41 37 42 - jobs.monit = { 38 + systemd.services.monit = { 43 39 description = "Monit system watcher"; 44 - 45 - startOn = config.services.monit.startOn; 46 - 47 - exec = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf"; 48 - 49 - respawn = true; 40 + after = [ "network-interfaces.target" ]; 41 + wantedBy = [ "multi-user.target" ]; 42 + script = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf"; 43 + serviceConfig.Restart = "always"; 50 44 }; 51 45 }; 52 46 }
+17 -12
nixos/modules/services/monitoring/ups.nix
··· 180 180 181 181 environment.systemPackages = [ pkgs.nut ]; 182 182 183 - jobs.upsmon = { 183 + systemd.services.upsmon = { 184 184 description = "Uninterruptible Power Supplies (Monitor)"; 185 - startOn = "ip-up"; 186 - daemonType = "fork"; 187 - exec = ''${pkgs.nut}/sbin/upsmon''; 185 + wantedBy = [ "ip-up.target" ]; 186 + serviceConfig.Type = "forking"; 187 + script = "${pkgs.nut}/sbin/upsmon"; 188 188 environment.NUT_CONFPATH = "/etc/nut/"; 189 189 environment.NUT_STATEPATH = "/var/lib/nut/"; 190 190 }; 191 191 192 - jobs.upsd = { 192 + systemd.services.upsd = { 193 193 description = "Uninterruptible Power Supplies (Daemon)"; 194 - startOn = "started network-interfaces and started upsmon"; 195 - daemonType = "fork"; 194 + wantedBy = [ "multi-user.target" ]; 195 + after = [ "network-interfaces.target" "upsmon.service" ]; 196 + serviceConfig.Type = "forking"; 196 197 # TODO: replace 'root' by another username. 197 - exec = ''${pkgs.nut}/sbin/upsd -u root''; 198 + script = "${pkgs.nut}/sbin/upsd -u root"; 198 199 environment.NUT_CONFPATH = "/etc/nut/"; 199 200 environment.NUT_STATEPATH = "/var/lib/nut/"; 200 201 }; 201 202 202 - jobs.upsdrv = { 203 + systemd.services.upsdrv = { 203 204 description = "Uninterruptible Power Supplies (Register all UPS)"; 204 - startOn = "started upsd"; 205 + wantedBy = [ "multi-user.target" ]; 206 + after = [ "upsd.service" ]; 205 207 # TODO: replace 'root' by another username. 206 - exec = ''${pkgs.nut}/bin/upsdrvctl -u root start''; 207 - task = true; 208 + script = ''${pkgs.nut}/bin/upsdrvctl -u root start''; 209 + serviceConfig = { 210 + Type = "oneshot"; 211 + RemainAfterExit = true; 212 + }; 208 213 environment.NUT_CONFPATH = "/etc/nut/"; 209 214 environment.NUT_STATEPATH = "/var/lib/nut/"; 210 215 };
+14 -24
nixos/modules/services/network-filesystems/drbd.nix
··· 31 31 32 32 }; 33 33 34 - 34 + 35 35 ###### implementation 36 36 37 37 config = mkIf cfg.enable { 38 - 38 + 39 39 environment.systemPackages = [ pkgs.drbd ]; 40 - 40 + 41 41 services.udev.packages = [ pkgs.drbd ]; 42 42 43 43 boot.kernelModules = [ "drbd" ]; ··· 52 52 target = "drbd.conf"; 53 53 }; 54 54 55 - jobs.drbd_up = 56 - { name = "drbd-up"; 57 - startOn = "stopped udevtrigger or ip-up"; 58 - task = true; 59 - script = 60 - '' 61 - ${pkgs.drbd}/sbin/drbdadm up all 62 - ''; 63 - }; 64 - 65 - jobs.drbd_down = 66 - { name = "drbd-down"; 67 - startOn = "starting shutdown"; 68 - task = true; 69 - script = 70 - '' 71 - ${pkgs.drbd}/sbin/drbdadm down all 72 - ''; 73 - }; 74 - 55 + systemd.services.drbd = { 56 + after = [ "systemd-udev.settle.service" ]; 57 + wants = [ "systemd-udev.settle.service" ]; 58 + wantedBy = [ "ip-up.target" ]; 59 + script = '' 60 + ${pkgs.drbd}/sbin/drbdadm up all 61 + ''; 62 + serviceConfig.ExecStop = '' 63 + ${pkgs.drbd}/sbin/drbdadm down all 64 + ''; 65 + }; 75 66 }; 76 - 77 67 }
+21 -27
nixos/modules/services/network-filesystems/openafs-client/default.nix
··· 72 72 } 73 73 ]; 74 74 75 - jobs.openafsClient = 76 - { name = "afsd"; 77 - 78 - description = "AFS client"; 79 - 80 - startOn = "started network-interfaces"; 81 - stopOn = "stopping network-interfaces"; 82 - 83 - preStart = '' 84 - mkdir -p -m 0755 /afs 85 - mkdir -m 0700 -p ${cfg.cacheDirectory} 86 - ${pkgs.module_init_tools}/sbin/insmod ${openafsPkgs}/lib/openafs/libafs-*.ko || true 87 - ${openafsPkgs}/sbin/afsd -confdir ${afsConfig} -cachedir ${cfg.cacheDirectory} ${if cfg.sparse then "-dynroot-sparse" else "-dynroot"} -fakestat -afsdb 88 - ${openafsPkgs}/bin/fs setcrypt ${if cfg.crypt then "on" else "off"} 89 - ''; 90 - 91 - # Doing this in preStop, because after these commands AFS is basically 92 - # stopped, so systemd has nothing to do, just noticing it. If done in 93 - # postStop, then we get a hang + kernel oops, because AFS can't be 94 - # stopped simply by sending signals to processes. 95 - preStop = '' 96 - ${pkgs.utillinux}/bin/umount /afs 97 - ${openafsPkgs}/sbin/afsd -shutdown 98 - ${pkgs.module_init_tools}/sbin/rmmod libafs 99 - ''; 75 + systemd.services.afsd = { 76 + description = "AFS client"; 77 + wantedBy = [ "multi-user.target" ]; 78 + after = [ "network-interfaces.target" ]; 100 79 101 - }; 80 + preStart = '' 81 + mkdir -p -m 0755 /afs 82 + mkdir -m 0700 -p ${cfg.cacheDirectory} 83 + ${pkgs.module_init_tools}/sbin/insmod ${openafsPkgs}/lib/openafs/libafs-*.ko || true 84 + ${openafsPkgs}/sbin/afsd -confdir ${afsConfig} -cachedir ${cfg.cacheDirectory} ${if cfg.sparse then "-dynroot-sparse" else "-dynroot"} -fakestat -afsdb 85 + ${openafsPkgs}/bin/fs setcrypt ${if cfg.crypt then "on" else "off"} 86 + ''; 102 87 88 + # Doing this in preStop, because after these commands AFS is basically 89 + # stopped, so systemd has nothing to do, just noticing it. If done in 90 + # postStop, then we get a hang + kernel oops, because AFS can't be 91 + # stopped simply by sending signals to processes. 92 + preStop = '' 93 + ${pkgs.utillinux}/bin/umount /afs 94 + ${openafsPkgs}/sbin/afsd -shutdown 95 + ${pkgs.module_init_tools}/sbin/rmmod libafs 96 + ''; 97 + }; 103 98 }; 104 - 105 99 }
+12 -15
nixos/modules/services/networking/amuled.nix
··· 57 57 gid = config.ids.gids.amule; 58 58 } ]; 59 59 60 - jobs.amuled = 61 - { description = "AMule daemon"; 60 + systemd.services.amuled = { 61 + description = "AMule daemon"; 62 + wantedBy = [ "ip-up.target" ]; 62 63 63 - startOn = "ip-up"; 64 + preStart = '' 65 + mkdir -p ${cfg.dataDir} 66 + chown ${user} ${cfg.dataDir} 67 + ''; 64 68 65 - preStart = '' 66 - mkdir -p ${cfg.dataDir} 67 - chown ${user} ${cfg.dataDir} 68 - ''; 69 - 70 - exec = '' 71 - ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \ 72 - -c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled' 73 - ''; 74 - }; 75 - 69 + script = '' 70 + ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \ 71 + -c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled' 72 + ''; 73 + }; 76 74 }; 77 - 78 75 }
+10 -13
nixos/modules/services/networking/bind.nix
··· 142 142 description = "BIND daemon user"; 143 143 }; 144 144 145 - jobs.bind = 146 - { description = "BIND name server job"; 145 + systemd.services.bind = { 146 + description = "BIND name server job"; 147 + after = [ "network-interfaces.target" ]; 148 + wantedBy = [ "multi-user.target" ]; 147 149 148 - startOn = "started network-interfaces"; 150 + preStart = '' 151 + ${pkgs.coreutils}/bin/mkdir -p /var/run/named 152 + chown ${bindUser} /var/run/named 153 + ''; 149 154 150 - preStart = 151 - '' 152 - ${pkgs.coreutils}/bin/mkdir -p /var/run/named 153 - chown ${bindUser} /var/run/named 154 - ''; 155 - 156 - exec = "${pkgs.bind}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f"; 157 - }; 158 - 155 + script = "${pkgs.bind}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f"; 156 + }; 159 157 }; 160 - 161 158 }
+57 -65
nixos/modules/services/networking/ejabberd.nix
··· 56 56 config = mkIf cfg.enable { 57 57 environment.systemPackages = [ pkgs.ejabberd ]; 58 58 59 - jobs.ejabberd = 60 - { description = "EJabberd server"; 59 + systemd.services.ejabberd = { 60 + description = "EJabberd server"; 61 + after = [ "network-interfaces.target" ]; 62 + wantedBy = [ "multi-user.target" ]; 63 + path = with pkgs; [ ejabberd coreutils bash gnused ]; 61 64 62 - startOn = "started network-interfaces"; 63 - stopOn = "stopping network-interfaces"; 65 + preStart = '' 66 + # Initialise state data 67 + mkdir -p ${cfg.logsDir} 64 68 65 - environment = { 66 - PATH = "$PATH:${pkgs.ejabberd}/sbin:${pkgs.ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin"; 67 - }; 69 + if ! test -d ${cfg.spoolDir} 70 + then 71 + initialize=1 72 + cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib 73 + fi 68 74 69 - preStart = 70 - '' 71 - PATH="$PATH:${pkgs.ejabberd}/sbin:${pkgs.ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin"; 72 - 73 - # Initialise state data 74 - mkdir -p ${cfg.logsDir} 75 + if ! test -d ${cfg.confDir} 76 + then 77 + mkdir -p ${cfg.confDir} 78 + cp ${pkgs.ejabberd}/etc/ejabberd/* ${cfg.confDir} 79 + sed -e 's|{hosts, \["localhost"\]}.|{hosts, \[${cfg.virtualHosts}\]}.|' ${pkgs.ejabberd}/etc/ejabberd/ejabberd.cfg > ${cfg.confDir}/ejabberd.cfg 80 + fi 75 81 76 - if ! test -d ${cfg.spoolDir} 77 - then 78 - initialize=1 79 - cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib 80 - fi 82 + ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} start 81 83 82 - if ! test -d ${cfg.confDir} 84 + ${if cfg.loadDumps == [] then "" else 85 + '' 86 + if [ "$initialize" = "1" ] 83 87 then 84 - mkdir -p ${cfg.confDir} 85 - cp ${pkgs.ejabberd}/etc/ejabberd/* ${cfg.confDir} 86 - sed -e 's|{hosts, \["localhost"\]}.|{hosts, \[${cfg.virtualHosts}\]}.|' ${pkgs.ejabberd}/etc/ejabberd/ejabberd.cfg > ${cfg.confDir}/ejabberd.cfg 87 - fi 88 - 89 - ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} start 90 - 91 - ${if cfg.loadDumps == [] then "" else 92 - '' 93 - if [ "$initialize" = "1" ] 94 - then 95 - # Wait until the ejabberd server is available for use 96 - count=0 97 - while ! ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} status 98 - do 99 - if [ $count -eq 30 ] 100 - then 101 - echo "Tried 30 times, giving up..." 102 - exit 1 103 - fi 88 + # Wait until the ejabberd server is available for use 89 + count=0 90 + while ! ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} status 91 + do 92 + if [ $count -eq 30 ] 93 + then 94 + echo "Tried 30 times, giving up..." 95 + exit 1 96 + fi 104 97 105 - echo "Ejabberd daemon not yet started. Waiting for 1 second..." 106 - count=$((count++)) 107 - sleep 1 108 - done 98 + echo "Ejabberd daemon not yet started. Waiting for 1 second..." 99 + count=$((count++)) 100 + sleep 1 101 + done 109 102 110 - ${concatMapStrings (dump: 111 - '' 112 - echo "Importing dump: ${dump}" 103 + ${concatMapStrings (dump: 104 + '' 105 + echo "Importing dump: ${dump}" 113 106 114 - if [ -f ${dump} ] 115 - then 116 - ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} load ${dump} 117 - elif [ -d ${dump} ] 118 - then 119 - for i in ${dump}/ejabberd-dump/* 120 - do 121 - ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} load $i 122 - done 123 - fi 124 - '') cfg.loadDumps} 125 - fi 126 - ''} 127 - ''; 107 + if [ -f ${dump} ] 108 + then 109 + ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} load ${dump} 110 + elif [ -d ${dump} ] 111 + then 112 + for i in ${dump}/ejabberd-dump/* 113 + do 114 + ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} load $i 115 + done 116 + fi 117 + '') cfg.loadDumps} 118 + fi 119 + ''} 120 + ''; 128 121 129 - postStop = 130 - '' 131 - ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} stop 132 - ''; 133 - }; 122 + postStop = '' 123 + ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} stop 124 + ''; 125 + }; 134 126 135 127 security.pam.services.ejabberd = {}; 136 128
+4 -5
nixos/modules/services/networking/git-daemon.nix
··· 16 16 type = types.bool; 17 17 default = false; 18 18 description = '' 19 - Enable Git daemon, which allows public hosting of git repositories 19 + Enable Git daemon, which allows public hosting of git repositories 20 20 without any access controls. This is mostly intended for read-only access. 21 21 22 22 You can allow write access by setting daemon.receivepack configuration ··· 115 115 gid = config.ids.gids.git; 116 116 }; 117 117 118 - jobs.gitDaemon = { 119 - name = "git-daemon"; 120 - startOn = "ip-up"; 121 - exec = "${pkgs.git}/bin/git daemon --reuseaddr " 118 + systemd.services."git-daemon" = { 119 + wantedBy = [ "ip-up.target" ]; 120 + script = "${pkgs.git}/bin/git daemon --reuseaddr " 122 121 + (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ") 123 122 + (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ") 124 123 + "--port=${toString cfg.port} --user=${cfg.user} --group=${cfg.group} ${cfg.options} "
+8 -24
nixos/modules/services/networking/gvpe.nix
··· 37 37 ''; 38 38 executable = true; 39 39 }); 40 - 41 - exec = "${pkgs.gvpe}/sbin/gvpe -c /var/gvpe -D ${cfg.nodename} " 42 - + " ${cfg.nodename}.pid-file=/var/gvpe/gvpe.pid" 43 - + " ${cfg.nodename}.if-up=if-up" 44 - + " &> /var/log/gvpe"; 45 - 46 - inherit (cfg) startOn stopOn; 47 40 in 48 41 49 42 { ··· 53 46 default = false; 54 47 description = '' 55 48 Whether to run gvpe 56 - ''; 57 - }; 58 - startOn = mkOption { 59 - default = "started network-interfaces"; 60 - description = '' 61 - Condition to start GVPE 62 - ''; 63 - }; 64 - stopOn = mkOption { 65 - default = "stopping network-interfaces"; 66 - description = '' 67 - Condition to stop GVPE 68 49 ''; 69 50 }; 70 51 nodename = mkOption { ··· 122 103 }; 123 104 }; 124 105 config = mkIf cfg.enable { 125 - jobs.gvpe = { 106 + systemd.services.gvpe = { 126 107 description = "GNU Virtual Private Ethernet node"; 127 - 128 - inherit startOn stopOn; 108 + after = [ "network-interfaces.target" ]; 109 + wantedBy = [ "multi-user.target" ]; 129 110 130 111 preStart = '' 131 112 mkdir -p /var/gvpe ··· 136 117 cp ${ifupScript} /var/gvpe/if-up 137 118 ''; 138 119 139 - inherit exec; 120 + script = "${pkgs.gvpe}/sbin/gvpe -c /var/gvpe -D ${cfg.nodename} " 121 + + " ${cfg.nodename}.pid-file=/var/gvpe/gvpe.pid" 122 + + " ${cfg.nodename}.if-up=if-up" 123 + + " &> /var/log/gvpe"; 140 124 141 - respawn = true; 125 + serviceConfig.Restart = "always"; 142 126 }; 143 127 }; 144 128 }
+10 -16
nixos/modules/services/networking/ifplugd.nix
··· 66 66 ###### implementation 67 67 68 68 config = mkIf cfg.enable { 69 - 70 - jobs.ifplugd = 71 - { description = "Network interface connectivity monitor"; 72 - 73 - startOn = "started network-interfaces"; 74 - stopOn = "stopping network-interfaces"; 75 - 76 - exec = 77 - '' 78 - ${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \ 79 - ${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \ 80 - --run ${plugScript} 81 - ''; 82 - }; 69 + systemd.services.ifplugd = { 70 + description = "Network interface connectivity monitor"; 71 + after = [ "network-interfaces.target" ]; 72 + wantedBy = [ "multi-user.target" ]; 73 + script = '' 74 + ${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \ 75 + ${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \ 76 + --run ${plugScript} 77 + ''; 78 + }; 83 79 84 80 environment.systemPackages = [ ifplugd ]; 85 - 86 81 }; 87 - 88 82 }
+6 -12
nixos/modules/services/networking/ircd-hybrid/default.nix
··· 121 121 122 122 users.extraGroups.ircd.gid = config.ids.gids.ircd; 123 123 124 - jobs.ircd_hybrid = 125 - { name = "ircd-hybrid"; 126 - 127 - description = "IRCD Hybrid server"; 128 - 129 - startOn = "started networking"; 130 - stopOn = "stopping networking"; 131 - 132 - exec = "${ircdService}/bin/control start"; 133 - }; 134 - 124 + systemd.services."ircd-hybrid" = { 125 + description = "IRCD Hybrid server"; 126 + after = [ "started networking" ]; 127 + wantedBy = [ "multi-user.target" ]; 128 + script = "${ircdService}/bin/control start"; 129 + }; 135 130 }; 136 - 137 131 }
+8 -9
nixos/modules/services/networking/oidentd.nix
··· 20 20 21 21 }; 22 22 23 - 23 + 24 24 ###### implementation 25 25 26 26 config = mkIf config.services.oidentd.enable { 27 - 28 - jobs.oidentd = 29 - { startOn = "started network-interfaces"; 30 - daemonType = "fork"; 31 - exec = "${pkgs.oidentd}/sbin/oidentd -u oidentd -g nogroup" + 32 - optionalString config.networking.enableIPv6 " -a ::" 33 - ; 34 - }; 27 + systemd.services.oidentd = { 28 + after = [ "network-interfaces.target" ]; 29 + wantedBy = [ "multi-user.target" ]; 30 + serviceConfig.Type = "forking"; 31 + script = "${pkgs.oidentd}/sbin/oidentd -u oidentd -g nogroup" + 32 + optionalString config.networking.enableIPv6 " -a ::"; 33 + }; 35 34 36 35 users.extraUsers.oidentd = { 37 36 description = "Ident Protocol daemon user";
+18 -30
nixos/modules/services/networking/openfire.nix
··· 2 2 3 3 with lib; 4 4 5 - let 6 - 7 - inherit (pkgs) jre openfire coreutils which gnugrep gawk gnused; 8 - 9 - extraStartDependency = 10 - if config.services.openfire.usePostgreSQL then "and started postgresql" else ""; 11 - 12 - in 13 - 14 5 { 15 - 16 6 ###### interface 17 7 18 8 options = { ··· 47 37 message = "OpenFire assertion failed."; 48 38 }; 49 39 50 - jobs.openfire = 51 - { description = "OpenFire XMPP server"; 52 - 53 - startOn = "started networking ${extraStartDependency}"; 54 - 55 - script = 56 - '' 57 - export PATH=${jre}/bin:${openfire}/bin:${coreutils}/bin:${which}/bin:${gnugrep}/bin:${gawk}/bin:${gnused}/bin 58 - export HOME=/tmp 59 - mkdir /var/log/openfire || true 60 - mkdir /etc/openfire || true 61 - for i in ${openfire}/conf.inst/*; do 62 - if ! test -f /etc/openfire/$(basename $i); then 63 - cp $i /etc/openfire/ 64 - fi 65 - done 66 - openfire start 67 - ''; # */ 68 - }; 69 - 40 + systemd.services.openfire = { 41 + description = "OpenFire XMPP server"; 42 + wantedBy = [ "multi-user.target" ]; 43 + after = [ "networking.target" ] ++ 44 + optional config.services.openfire.usePostgreSQL "postgresql.service"; 45 + path = with pkgs; [ jre openfire coreutils which gnugrep gawk gnused ]; 46 + script = '' 47 + export HOME=/tmp 48 + mkdir /var/log/openfire || true 49 + mkdir /etc/openfire || true 50 + for i in ${openfire}/conf.inst/*; do 51 + if ! test -f /etc/openfire/$(basename $i); then 52 + cp $i /etc/openfire/ 53 + fi 54 + done 55 + openfire start 56 + ''; # */ 57 + }; 70 58 }; 71 59 72 60 }
+9 -16
nixos/modules/services/networking/prayer.nix
··· 83 83 gid = config.ids.gids.prayer; 84 84 }; 85 85 86 - jobs.prayer = 87 - { name = "prayer"; 88 - 89 - startOn = "startup"; 90 - 91 - preStart = 92 - '' 93 - mkdir -m 0755 -p ${stateDir} 94 - chown ${prayerUser}.${prayerGroup} ${stateDir} 95 - ''; 96 - 97 - daemonType = "daemon"; 98 - 99 - exec = "${prayer}/sbin/prayer --config-file=${prayerCfg}"; 100 - }; 86 + systemd.services.prayer = { 87 + wantedBy = [ "multi-user.target" ]; 88 + serviceConfig.Type = "forking"; 89 + preStart = '' 90 + mkdir -m 0755 -p ${stateDir} 91 + chown ${prayerUser}.${prayerGroup} ${stateDir} 92 + ''; 93 + script = "${prayer}/sbin/prayer --config-file=${prayerCfg}"; 94 + }; 101 95 }; 102 - 103 96 }
+5 -7
nixos/modules/services/networking/radicale.nix
··· 33 33 }; 34 34 35 35 config = mkIf cfg.enable { 36 - 37 36 environment.systemPackages = [ pkgs.pythonPackages.radicale ]; 38 37 39 - jobs.radicale = { 38 + systemd.services.radicale = { 40 39 description = "A Simple Calendar and Contact Server"; 41 - startOn = "started network-interfaces"; 42 - exec = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d"; 43 - daemonType = "fork"; 40 + after = [ "network-interfaces.target" ]; 41 + wantedBy = [ "multi-user.target" ]; 42 + script = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d"; 43 + serviceConfig.Type = "forking"; 44 44 }; 45 - 46 45 }; 47 - 48 46 }
+3 -3
nixos/modules/services/networking/softether.nix
··· 61 61 dataDir = cfg.dataDir; 62 62 })) 63 63 ]; 64 - jobs.softether = { 64 + systemd.services.softether = { 65 65 description = "SoftEther VPN services initial job"; 66 - startOn = "started network-interfaces"; 66 + after = [ "network-interfaces.target" ]; 67 + wantedBy = [ "multi-user.target" ]; 67 68 preStart = '' 68 69 for d in vpnserver vpnbridge vpnclient vpncmd; do 69 70 if ! test -e ${cfg.dataDir}/$d; then ··· 74 75 rm -rf ${cfg.dataDir}/vpncmd/vpncmd 75 76 ln -s ${pkg}${cfg.dataDir}/vpncmd/vpncmd ${cfg.dataDir}/vpncmd/vpncmd 76 77 ''; 77 - exec = "true"; 78 78 }; 79 79 } 80 80
+47 -49
nixos/modules/services/networking/ssh/lshd.nix
··· 117 117 118 118 services.lshd.subsystems = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ]; 119 119 120 - jobs.lshd = 121 - { description = "GNU lshd SSH2 daemon"; 120 + systemd.services.lshd = { 121 + description = "GNU lshd SSH2 daemon"; 122 122 123 - startOn = "started network-interfaces"; 124 - stopOn = "stopping network-interfaces"; 123 + after = [ "network-interfaces.target" ]; 125 124 126 - environment = 127 - { LD_LIBRARY_PATH = config.system.nssModules.path; }; 125 + wantedBy = [ "multi-user.target" ]; 128 126 129 - preStart = 130 - '' 131 - test -d /etc/lsh || mkdir -m 0755 -p /etc/lsh 132 - test -d /var/spool/lsh || mkdir -m 0755 -p /var/spool/lsh 127 + environment = { 128 + LD_LIBRARY_PATH = config.system.nssModules.path; 129 + }; 133 130 134 - if ! test -f /var/spool/lsh/yarrow-seed-file 135 - then 136 - # XXX: It would be nice to provide feedback to the 137 - # user when this fails, so that they can retry it 138 - # manually. 139 - ${lsh}/bin/lsh-make-seed --sloppy \ 140 - -o /var/spool/lsh/yarrow-seed-file 141 - fi 131 + preStart = '' 132 + test -d /etc/lsh || mkdir -m 0755 -p /etc/lsh 133 + test -d /var/spool/lsh || mkdir -m 0755 -p /var/spool/lsh 142 134 143 - if ! test -f "${cfg.hostKey}" 144 - then 145 - ${lsh}/bin/lsh-keygen --server | \ 146 - ${lsh}/bin/lsh-writekey --server -o "${cfg.hostKey}" 147 - fi 148 - ''; 135 + if ! test -f /var/spool/lsh/yarrow-seed-file 136 + then 137 + # XXX: It would be nice to provide feedback to the 138 + # user when this fails, so that they can retry it 139 + # manually. 140 + ${lsh}/bin/lsh-make-seed --sloppy \ 141 + -o /var/spool/lsh/yarrow-seed-file 142 + fi 149 143 150 - exec = with cfg; 151 - '' 152 - ${lsh}/sbin/lshd --daemonic \ 153 - --password-helper="${lsh}/sbin/lsh-pam-checkpw" \ 154 - -p ${toString portNumber} \ 155 - ${if interfaces == [] then "" 156 - else (concatStrings (map (i: "--interface=\"${i}\"") 157 - interfaces))} \ 158 - -h "${hostKey}" \ 159 - ${if !syslog then "--no-syslog" else ""} \ 160 - ${if passwordAuthentication then "--password" else "--no-password" } \ 161 - ${if publicKeyAuthentication then "--publickey" else "--no-publickey" } \ 162 - ${if rootLogin then "--root-login" else "--no-root-login" } \ 163 - ${if loginShell != null then "--login-shell=\"${loginShell}\"" else "" } \ 164 - ${if srpKeyExchange then "--srp-keyexchange" else "--no-srp-keyexchange" } \ 165 - ${if !tcpForwarding then "--no-tcpip-forward" else "--tcpip-forward"} \ 166 - ${if x11Forwarding then "--x11-forward" else "--no-x11-forward" } \ 167 - --subsystems=${concatStringsSep "," 168 - (map (pair: (head pair) + "=" + 169 - (head (tail pair))) 170 - subsystems)} 171 - ''; 172 - }; 144 + if ! test -f "${cfg.hostKey}" 145 + then 146 + ${lsh}/bin/lsh-keygen --server | \ 147 + ${lsh}/bin/lsh-writekey --server -o "${cfg.hostKey}" 148 + fi 149 + ''; 173 150 174 - security.pam.services.lshd = {}; 151 + script = with cfg; '' 152 + ${lsh}/sbin/lshd --daemonic \ 153 + --password-helper="${lsh}/sbin/lsh-pam-checkpw" \ 154 + -p ${toString portNumber} \ 155 + ${if interfaces == [] then "" 156 + else (concatStrings (map (i: "--interface=\"${i}\"") 157 + interfaces))} \ 158 + -h "${hostKey}" \ 159 + ${if !syslog then "--no-syslog" else ""} \ 160 + ${if passwordAuthentication then "--password" else "--no-password" } \ 161 + ${if publicKeyAuthentication then "--publickey" else "--no-publickey" } \ 162 + ${if rootLogin then "--root-login" else "--no-root-login" } \ 163 + ${if loginShell != null then "--login-shell=\"${loginShell}\"" else "" } \ 164 + ${if srpKeyExchange then "--srp-keyexchange" else "--no-srp-keyexchange" } \ 165 + ${if !tcpForwarding then "--no-tcpip-forward" else "--tcpip-forward"} \ 166 + ${if x11Forwarding then "--x11-forward" else "--no-x11-forward" } \ 167 + --subsystems=${concatStringsSep "," 168 + (map (pair: (head pair) + "=" + 169 + (head (tail pair))) 170 + subsystems)} 171 + ''; 172 + }; 175 173 174 + security.pam.services.lshd = {}; 176 175 }; 177 - 178 176 }
+4 -4
nixos/modules/services/networking/tcpcrypt.nix
··· 35 35 description = "tcpcrypt daemon user"; 36 36 }; 37 37 38 - jobs.tcpcrypt = { 38 + systemd.services.tcpcrypt = { 39 39 description = "tcpcrypt"; 40 40 41 - wantedBy = ["multi-user.target"]; 42 - after = ["network-interfaces.target"]; 41 + wantedBy = [ "multi-user.target" ]; 42 + after = [ "network-interfaces.target" ]; 43 43 44 44 path = [ pkgs.iptables pkgs.tcpcrypt pkgs.procps ]; 45 45 ··· 58 58 iptables -t mangle -I POSTROUTING -j nixos-tcpcrypt 59 59 ''; 60 60 61 - exec = "tcpcryptd -x 0x10"; 61 + script = "tcpcryptd -x 0x10"; 62 62 63 63 postStop = '' 64 64 if [ -f /run/pre-tcpcrypt-ecn-state ]; then
+5 -9
nixos/modules/services/networking/wicd.nix
··· 25 25 26 26 environment.systemPackages = [pkgs.wicd]; 27 27 28 - jobs.wicd = 29 - { startOn = "started network-interfaces"; 30 - stopOn = "stopping network-interfaces"; 31 - 32 - script = 33 - "${pkgs.wicd}/sbin/wicd -f"; 34 - }; 28 + systemd.services.wicd = { 29 + after = [ "network-interfaces.target" ]; 30 + wantedBy = [ "multi-user.target" ]; 31 + script = "${pkgs.wicd}/sbin/wicd -f"; 32 + }; 35 33 36 34 services.dbus.enable = true; 37 35 services.dbus.packages = [pkgs.wicd]; 38 - 39 36 }; 40 - 41 37 }
+7 -15
nixos/modules/services/networking/xinetd.nix
··· 6 6 7 7 cfg = config.services.xinetd; 8 8 9 - inherit (pkgs) xinetd; 10 - 11 9 configFile = pkgs.writeText "xinetd.conf" 12 10 '' 13 11 defaults ··· 141 139 ###### implementation 142 140 143 141 config = mkIf cfg.enable { 144 - 145 - jobs.xinetd = 146 - { description = "xinetd server"; 147 - 148 - startOn = "started network-interfaces"; 149 - stopOn = "stopping network-interfaces"; 150 - 151 - path = [ xinetd ]; 152 - 153 - exec = "xinetd -syslog daemon -dontfork -stayalive -f ${configFile}"; 154 - }; 155 - 142 + systemd.services.xinetd = { 143 + description = "xinetd server"; 144 + after = [ "network-interfaces.target" ]; 145 + wantedBy = [ "multi-user.target" ]; 146 + path = [ pkgs.xinetd ]; 147 + script = "xinetd -syslog daemon -dontfork -stayalive -f ${configFile}"; 148 + }; 156 149 }; 157 - 158 150 }
+36 -38
nixos/modules/services/scheduling/atd.nix
··· 66 66 gid = config.ids.gids.atd; 67 67 }; 68 68 69 - jobs.atd = 70 - { description = "Job Execution Daemon (atd)"; 69 + systemd.services.atd = { 70 + description = "Job Execution Daemon (atd)"; 71 + after = [ "systemd-udev-settle.service" ]; 72 + wants = [ "systemd-udev-settle.service" ]; 73 + wantedBy = [ "multi-user.target" ]; 71 74 72 - startOn = "stopped udevtrigger"; 75 + path = [ at ]; 73 76 74 - path = [ at ]; 77 + preStart = '' 78 + # Snippets taken and adapted from the original `install' rule of 79 + # the makefile. 75 80 76 - preStart = 77 - '' 78 - # Snippets taken and adapted from the original `install' rule of 79 - # the makefile. 80 - 81 - # We assume these values are those actually used in Nixpkgs for 82 - # `at'. 83 - spooldir=/var/spool/atspool 84 - jobdir=/var/spool/atjobs 85 - etcdir=/etc/at 86 - 87 - for dir in "$spooldir" "$jobdir" "$etcdir"; do 88 - if [ ! -d "$dir" ]; then 89 - mkdir -p "$dir" 90 - chown atd:atd "$dir" 91 - fi 92 - done 93 - chmod 1770 "$spooldir" "$jobdir" 94 - ${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""} 95 - if [ ! -f "$etcdir"/at.deny ]; then 96 - touch "$etcdir"/at.deny 97 - chown root:atd "$etcdir"/at.deny 98 - chmod 640 "$etcdir"/at.deny 99 - fi 100 - if [ ! -f "$jobdir"/.SEQ ]; then 101 - touch "$jobdir"/.SEQ 102 - chown atd:atd "$jobdir"/.SEQ 103 - chmod 600 "$jobdir"/.SEQ 104 - fi 105 - ''; 81 + # We assume these values are those actually used in Nixpkgs for 82 + # `at'. 83 + spooldir=/var/spool/atspool 84 + jobdir=/var/spool/atjobs 85 + etcdir=/etc/at 106 86 107 - exec = "atd"; 87 + for dir in "$spooldir" "$jobdir" "$etcdir"; do 88 + if [ ! -d "$dir" ]; then 89 + mkdir -p "$dir" 90 + chown atd:atd "$dir" 91 + fi 92 + done 93 + chmod 1770 "$spooldir" "$jobdir" 94 + ${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""} 95 + if [ ! -f "$etcdir"/at.deny ]; then 96 + touch "$etcdir"/at.deny 97 + chown root:atd "$etcdir"/at.deny 98 + chmod 640 "$etcdir"/at.deny 99 + fi 100 + if [ ! -f "$jobdir"/.SEQ ]; then 101 + touch "$jobdir"/.SEQ 102 + chown atd:atd "$jobdir"/.SEQ 103 + chmod 600 "$jobdir"/.SEQ 104 + fi 105 + ''; 108 106 109 - daemonType = "fork"; 110 - }; 107 + script = "atd"; 111 108 109 + serviceConfig.Type = "forking"; 110 + }; 112 111 }; 113 - 114 112 }
+16 -20
nixos/modules/services/scheduling/fcron.nix
··· 108 108 109 109 security.setuidPrograms = [ "fcrontab" ]; 110 110 111 - jobs.fcron = 112 - { description = "fcron daemon"; 113 - 114 - startOn = "startup"; 115 - 116 - after = [ "local-fs.target" ]; 117 - 118 - environment = 119 - { PATH = "/run/current-system/sw/bin"; 120 - }; 111 + systemd.services.fcron = { 112 + description = "fcron daemon"; 113 + after = [ "local-fs.target" ]; 114 + wantedBy = [ "multi-user.target" ]; 121 115 122 - preStart = 123 - '' 124 - ${pkgs.coreutils}/bin/mkdir -m 0700 -p /var/spool/fcron 125 - # load system crontab file 126 - ${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab} 127 - ''; 116 + # FIXME use specific path 117 + environment = { 118 + PATH = "/run/current-system/sw/bin"; 119 + }; 128 120 129 - daemonType = "fork"; 121 + preStart = '' 122 + ${pkgs.coreutils}/bin/mkdir -m 0700 -p /var/spool/fcron 123 + # load system crontab file 124 + ${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab} 125 + ''; 130 126 131 - exec = "${pkgs.fcron}/sbin/fcron -m ${toString cfg.maxSerialJobs} ${queuelen}"; 132 - }; 127 + serviceConfig.Type = "forking"; 133 128 129 + script = "${pkgs.fcron}/sbin/fcron -m ${toString cfg.maxSerialJobs} ${queuelen}"; 130 + }; 134 131 }; 135 - 136 132 }
+15 -17
nixos/modules/services/security/fprot.nix
··· 67 67 68 68 services.cron.systemCronJobs = [ "*/${toString cfg.updater.frequency} * * * * root start fprot-updater" ]; 69 69 70 - jobs = { 71 - fprot_updater = { 72 - name = "fprot-updater"; 73 - task = true; 74 - 75 - # have to copy fpupdate executable because it insists on storing the virus database in the same dir 76 - preStart = '' 77 - mkdir -m 0755 -p ${stateDir} 78 - chown ${fprotUser}:${fprotGroup} ${stateDir} 79 - cp ${pkgs.fprot}/opt/f-prot/fpupdate ${stateDir} 80 - ln -sf ${cfg.updater.productData} ${stateDir}/product.data 81 - ''; 82 - #setuid = fprotUser; 83 - #setgid = fprotGroup; 84 - exec = "/var/lib/fprot/fpupdate --keyfile ${cfg.updater.licenseKeyfile}"; 70 + systemd.services."fprot-updater" = { 71 + serviceConfig = { 72 + Type = "oneshot"; 73 + RemainAfterExit = false; 85 74 }; 86 - }; 75 + wantedBy = [ "multi-user.target" ]; 87 76 88 - }; 77 + # have to copy fpupdate executable because it insists on storing the virus database in the same dir 78 + preStart = '' 79 + mkdir -m 0755 -p ${stateDir} 80 + chown ${fprotUser}:${fprotGroup} ${stateDir} 81 + cp ${pkgs.fprot}/opt/f-prot/fpupdate ${stateDir} 82 + ln -sf ${cfg.updater.productData} ${stateDir}/product.data 83 + ''; 89 84 85 + script = "/var/lib/fprot/fpupdate --keyfile ${cfg.updater.licenseKeyfile}"; 86 + }; 87 + }; 90 88 }
+13 -20
nixos/modules/services/system/kerberos.nix
··· 45 45 serverArgs = "${pkgs.heimdal}/sbin/kadmind"; 46 46 }; 47 47 48 - jobs.kdc = 49 - { description = "Kerberos Domain Controller daemon"; 48 + systemd.services.kdc = { 49 + description = "Kerberos Domain Controller daemon"; 50 + wantedBy = [ "multi-user.target" ]; 51 + preStart = '' 52 + mkdir -m 0755 -p ${stateDir} 53 + ''; 54 + script = "${heimdal}/sbin/kdc"; 55 + }; 50 56 51 - startOn = "ip-up"; 52 - 53 - preStart = 54 - '' 55 - mkdir -m 0755 -p ${stateDir} 56 - ''; 57 - 58 - exec = "${heimdal}/sbin/kdc"; 59 - 60 - }; 61 - 62 - jobs.kpasswdd = 63 - { description = "Kerberos Domain Controller daemon"; 64 - 65 - startOn = "ip-up"; 66 - 67 - exec = "${heimdal}/sbin/kpasswdd"; 68 - }; 57 + systemd.services.kpasswdd = { 58 + description = "Kerberos Domain Controller daemon"; 59 + wantedBy = [ "multi-user.target" ]; 60 + script = "${heimdal}/sbin/kpasswdd"; 61 + }; 69 62 }; 70 63 71 64 }
+12 -14
nixos/modules/services/system/uptimed.nix
··· 45 45 home = stateDir; 46 46 }; 47 47 48 - jobs.uptimed = 49 - { description = "Uptimed daemon"; 48 + systemd.services.uptimed = { 49 + description = "Uptimed daemon"; 50 + wantedBy = [ "multi-user.target" ]; 50 51 51 - startOn = "startup"; 52 - 53 - preStart = 54 - '' 55 - mkdir -m 0755 -p ${stateDir} 56 - chown ${uptimedUser} ${stateDir} 52 + preStart = '' 53 + mkdir -m 0755 -p ${stateDir} 54 + chown ${uptimedUser} ${stateDir} 57 55 58 - if ! test -f ${stateDir}/bootid ; then 59 - ${uptimed}/sbin/uptimed -b 60 - fi 61 - ''; 56 + if ! test -f ${stateDir}/bootid ; then 57 + ${uptimed}/sbin/uptimed -b 58 + fi 59 + ''; 62 60 63 - exec = "${uptimed}/sbin/uptimed"; 64 - }; 61 + script = "${uptimed}/sbin/uptimed"; 62 + }; 65 63 66 64 }; 67 65
+5 -8
nixos/modules/services/web-servers/jboss/default.nix
··· 71 71 ###### implementation 72 72 73 73 config = mkIf config.services.jboss.enable { 74 - 75 - jobs.jboss = 76 - { description = "JBoss server"; 77 - 78 - exec = "${jbossService}/bin/control start"; 79 - }; 80 - 74 + systemd.services.jboss = { 75 + description = "JBoss server"; 76 + script = "${jbossService}/bin/control start"; 77 + wantedBy = [ "multi-user.target" ]; 78 + }; 81 79 }; 82 - 83 80 }
+179 -183
nixos/modules/services/web-servers/tomcat.nix
··· 127 127 extraGroups = cfg.extraGroups; 128 128 }; 129 129 130 - jobs.tomcat = 131 - { description = "Apache Tomcat server"; 130 + systemd.services.tomcat = { 131 + description = "Apache Tomcat server"; 132 + wantedBy = [ "multi-user.target" ]; 133 + after = [ "network-interfaces.target" ]; 134 + serviceConfig.Type = "daemon"; 132 135 133 - startOn = "started network-interfaces"; 134 - stopOn = "stopping network-interfaces"; 136 + preStart = '' 137 + # Create the base directory 138 + mkdir -p ${cfg.baseDir} 135 139 136 - daemonType = "daemon"; 140 + # Create a symlink to the bin directory of the tomcat component 141 + ln -sfn ${tomcat}/bin ${cfg.baseDir}/bin 137 142 138 - preStart = 139 - '' 140 - # Create the base directory 141 - mkdir -p ${cfg.baseDir} 143 + # Create a conf/ directory 144 + mkdir -p ${cfg.baseDir}/conf 145 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/conf 142 146 143 - # Create a symlink to the bin directory of the tomcat component 144 - ln -sfn ${tomcat}/bin ${cfg.baseDir}/bin 147 + # Symlink the config files in the conf/ directory (except for catalina.properties and server.xml) 148 + for i in $(ls ${tomcat}/conf | grep -v catalina.properties | grep -v server.xml) 149 + do 150 + ln -sfn ${tomcat}/conf/$i ${cfg.baseDir}/conf/`basename $i` 151 + done 152 + 153 + # Create subdirectory for virtual hosts 154 + mkdir -p ${cfg.baseDir}/virtualhosts 155 + 156 + # Create a modified catalina.properties file 157 + # Change all references from CATALINA_HOME to CATALINA_BASE and add support for shared libraries 158 + sed -e 's|''${catalina.home}|''${catalina.base}|g' \ 159 + -e 's|shared.loader=|shared.loader=''${catalina.base}/shared/lib/*.jar|' \ 160 + ${tomcat}/conf/catalina.properties > ${cfg.baseDir}/conf/catalina.properties 145 161 146 - # Create a conf/ directory 147 - mkdir -p ${cfg.baseDir}/conf 148 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/conf 162 + # Create a modified server.xml which also includes all virtual hosts 163 + sed -e "/<Engine name=\"Catalina\" defaultHost=\"localhost\">/a\ ${ 164 + toString (map (virtualHost: ''<Host name=\"${virtualHost.name}\" appBase=\"virtualhosts/${virtualHost.name}/webapps\" unpackWARs=\"true\" autoDeploy=\"true\" xmlValidation=\"false\" xmlNamespaceAware=\"false\" >${if cfg.logPerVirtualHost then ''<Valve className=\"org.apache.catalina.valves.AccessLogValve\" directory=\"logs/${virtualHost.name}\" prefix=\"${virtualHost.name}_access_log.\" pattern=\"combined\" resolveHosts=\"false\"/>'' else ""}</Host>'') cfg.virtualHosts)}" \ 165 + ${tomcat}/conf/server.xml > ${cfg.baseDir}/conf/server.xml 149 166 150 - # Symlink the config files in the conf/ directory (except for catalina.properties and server.xml) 151 - for i in $(ls ${tomcat}/conf | grep -v catalina.properties | grep -v server.xml) 152 - do 153 - ln -sfn ${tomcat}/conf/$i ${cfg.baseDir}/conf/`basename $i` 154 - done 167 + # Create a logs/ directory 168 + mkdir -p ${cfg.baseDir}/logs 169 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/logs 170 + ${if cfg.logPerVirtualHost then 171 + toString (map (h: '' 172 + mkdir -p ${cfg.baseDir}/logs/${h.name} 173 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/logs/${h.name} 174 + '') cfg.virtualHosts) else ''''} 155 175 156 - # Create subdirectory for virtual hosts 157 - mkdir -p ${cfg.baseDir}/virtualhosts 176 + # Create a temp/ directory 177 + mkdir -p ${cfg.baseDir}/temp 178 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/temp 158 179 159 - # Create a modified catalina.properties file 160 - # Change all references from CATALINA_HOME to CATALINA_BASE and add support for shared libraries 161 - sed -e 's|''${catalina.home}|''${catalina.base}|g' \ 162 - -e 's|shared.loader=|shared.loader=''${catalina.base}/shared/lib/*.jar|' \ 163 - ${tomcat}/conf/catalina.properties > ${cfg.baseDir}/conf/catalina.properties 180 + # Create a lib/ directory 181 + mkdir -p ${cfg.baseDir}/lib 182 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/lib 164 183 165 - # Create a modified server.xml which also includes all virtual hosts 166 - sed -e "/<Engine name=\"Catalina\" defaultHost=\"localhost\">/a\ ${ 167 - toString (map (virtualHost: ''<Host name=\"${virtualHost.name}\" appBase=\"virtualhosts/${virtualHost.name}/webapps\" unpackWARs=\"true\" autoDeploy=\"true\" xmlValidation=\"false\" xmlNamespaceAware=\"false\" >${if cfg.logPerVirtualHost then ''<Valve className=\"org.apache.catalina.valves.AccessLogValve\" directory=\"logs/${virtualHost.name}\" prefix=\"${virtualHost.name}_access_log.\" pattern=\"combined\" resolveHosts=\"false\"/>'' else ""}</Host>'') cfg.virtualHosts)}" \ 168 - ${tomcat}/conf/server.xml > ${cfg.baseDir}/conf/server.xml 184 + # Create a shared/lib directory 185 + mkdir -p ${cfg.baseDir}/shared/lib 186 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/shared/lib 169 187 170 - # Create a logs/ directory 171 - mkdir -p ${cfg.baseDir}/logs 172 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/logs 173 - ${if cfg.logPerVirtualHost then 174 - toString (map (h: '' 175 - mkdir -p ${cfg.baseDir}/logs/${h.name} 176 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/logs/${h.name} 177 - '') cfg.virtualHosts) else ''''} 188 + # Create a webapps/ directory 189 + mkdir -p ${cfg.baseDir}/webapps 190 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/webapps 178 191 179 - # Create a temp/ directory 180 - mkdir -p ${cfg.baseDir}/temp 181 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/temp 192 + # Symlink all the given common libs files or paths into the lib/ directory 193 + for i in ${tomcat} ${toString cfg.commonLibs} 194 + do 195 + if [ -f $i ] 196 + then 197 + # If the given web application is a file, symlink it into the common/lib/ directory 198 + ln -sfn $i ${cfg.baseDir}/lib/`basename $i` 199 + elif [ -d $i ] 200 + then 201 + # If the given web application is a directory, then iterate over the files 202 + # in the special purpose directories and symlink them into the tomcat tree 182 203 183 - # Create a lib/ directory 184 - mkdir -p ${cfg.baseDir}/lib 185 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/lib 204 + for j in $i/lib/* 205 + do 206 + ln -sfn $j ${cfg.baseDir}/lib/`basename $j` 207 + done 208 + fi 209 + done 186 210 187 - # Create a shared/lib directory 188 - mkdir -p ${cfg.baseDir}/shared/lib 189 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/shared/lib 211 + # Symlink all the given shared libs files or paths into the shared/lib/ directory 212 + for i in ${toString cfg.sharedLibs} 213 + do 214 + if [ -f $i ] 215 + then 216 + # If the given web application is a file, symlink it into the common/lib/ directory 217 + ln -sfn $i ${cfg.baseDir}/shared/lib/`basename $i` 218 + elif [ -d $i ] 219 + then 220 + # If the given web application is a directory, then iterate over the files 221 + # in the special purpose directories and symlink them into the tomcat tree 190 222 191 - # Create a webapps/ directory 192 - mkdir -p ${cfg.baseDir}/webapps 193 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/webapps 223 + for j in $i/shared/lib/* 224 + do 225 + ln -sfn $j ${cfg.baseDir}/shared/lib/`basename $j` 226 + done 227 + fi 228 + done 194 229 195 - # Symlink all the given common libs files or paths into the lib/ directory 196 - for i in ${tomcat} ${toString cfg.commonLibs} 197 - do 198 - if [ -f $i ] 199 - then 200 - # If the given web application is a file, symlink it into the common/lib/ directory 201 - ln -sfn $i ${cfg.baseDir}/lib/`basename $i` 202 - elif [ -d $i ] 203 - then 204 - # If the given web application is a directory, then iterate over the files 205 - # in the special purpose directories and symlink them into the tomcat tree 230 + # Symlink all the given web applications files or paths into the webapps/ directory 231 + for i in ${toString cfg.webapps} 232 + do 233 + if [ -f $i ] 234 + then 235 + # If the given web application is a file, symlink it into the webapps/ directory 236 + ln -sfn $i ${cfg.baseDir}/webapps/`basename $i` 237 + elif [ -d $i ] 238 + then 239 + # If the given web application is a directory, then iterate over the files 240 + # in the special purpose directories and symlink them into the tomcat tree 206 241 207 - for j in $i/lib/* 208 - do 209 - ln -sfn $j ${cfg.baseDir}/lib/`basename $j` 210 - done 211 - fi 212 - done 242 + for j in $i/webapps/* 243 + do 244 + ln -sfn $j ${cfg.baseDir}/webapps/`basename $j` 245 + done 213 246 214 - # Symlink all the given shared libs files or paths into the shared/lib/ directory 215 - for i in ${toString cfg.sharedLibs} 216 - do 217 - if [ -f $i ] 247 + # Also symlink the configuration files if they are included 248 + if [ -d $i/conf/Catalina ] 218 249 then 219 - # If the given web application is a file, symlink it into the common/lib/ directory 220 - ln -sfn $i ${cfg.baseDir}/shared/lib/`basename $i` 221 - elif [ -d $i ] 222 - then 223 - # If the given web application is a directory, then iterate over the files 224 - # in the special purpose directories and symlink them into the tomcat tree 225 - 226 - for j in $i/shared/lib/* 250 + for j in $i/conf/Catalina/* 227 251 do 228 - ln -sfn $j ${cfg.baseDir}/shared/lib/`basename $j` 252 + mkdir -p ${cfg.baseDir}/conf/Catalina/localhost 253 + ln -sfn $j ${cfg.baseDir}/conf/Catalina/localhost/`basename $j` 229 254 done 230 255 fi 231 - done 256 + fi 257 + done 258 + 259 + ${toString (map (virtualHost: '' 260 + # Create webapps directory for the virtual host 261 + mkdir -p ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps 262 + 263 + # Modify ownership 264 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps 265 + 266 + # Symlink all the given web applications files or paths into the webapps/ directory 267 + # of this virtual host 268 + for i in "${if virtualHost ? webapps then toString virtualHost.webapps else ""}" 269 + do 270 + if [ -f $i ] 271 + then 272 + # If the given web application is a file, symlink it into the webapps/ directory 273 + ln -sfn $i ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps/`basename $i` 274 + elif [ -d $i ] 275 + then 276 + # If the given web application is a directory, then iterate over the files 277 + # in the special purpose directories and symlink them into the tomcat tree 278 + 279 + for j in $i/webapps/* 280 + do 281 + ln -sfn $j ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps/`basename $j` 282 + done 283 + 284 + # Also symlink the configuration files if they are included 285 + if [ -d $i/conf/Catalina ] 286 + then 287 + for j in $i/conf/Catalina/* 288 + do 289 + mkdir -p ${cfg.baseDir}/conf/Catalina/${virtualHost.name} 290 + ln -sfn $j ${cfg.baseDir}/conf/Catalina/${virtualHost.name}/`basename $j` 291 + done 292 + fi 293 + fi 294 + done 295 + 296 + '' 297 + ) cfg.virtualHosts) } 298 + 299 + # Create a work/ directory 300 + mkdir -p ${cfg.baseDir}/work 301 + chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/work 302 + 303 + ${if cfg.axis2.enable then 304 + '' 305 + # Copy the Axis2 web application 306 + cp -av ${pkgs.axis2}/webapps/axis2 ${cfg.baseDir}/webapps 307 + 308 + # Turn off addressing, which causes many errors 309 + sed -i -e 's%<module ref="addressing"/>%<!-- <module ref="addressing"/> -->%' ${cfg.baseDir}/webapps/axis2/WEB-INF/conf/axis2.xml 232 310 233 - # Symlink all the given web applications files or paths into the webapps/ directory 234 - for i in ${toString cfg.webapps} 311 + # Modify permissions on the Axis2 application 312 + chown -R ${cfg.user}:${cfg.group} ${cfg.baseDir}/webapps/axis2 313 + 314 + # Symlink all the given web service files or paths into the webapps/axis2/WEB-INF/services directory 315 + for i in ${toString cfg.axis2.services} 235 316 do 236 317 if [ -f $i ] 237 318 then 238 - # If the given web application is a file, symlink it into the webapps/ directory 239 - ln -sfn $i ${cfg.baseDir}/webapps/`basename $i` 319 + # If the given web service is a file, symlink it into the webapps/axis2/WEB-INF/services 320 + ln -sfn $i ${cfg.baseDir}/webapps/axis2/WEB-INF/services/`basename $i` 240 321 elif [ -d $i ] 241 322 then 242 323 # If the given web application is a directory, then iterate over the files 243 324 # in the special purpose directories and symlink them into the tomcat tree 244 325 245 - for j in $i/webapps/* 326 + for j in $i/webapps/axis2/WEB-INF/services/* 246 327 do 247 - ln -sfn $j ${cfg.baseDir}/webapps/`basename $j` 328 + ln -sfn $j ${cfg.baseDir}/webapps/axis2/WEB-INF/services/`basename $j` 248 329 done 249 330 250 331 # Also symlink the configuration files if they are included ··· 252 333 then 253 334 for j in $i/conf/Catalina/* 254 335 do 255 - mkdir -p ${cfg.baseDir}/conf/Catalina/localhost 256 336 ln -sfn $j ${cfg.baseDir}/conf/Catalina/localhost/`basename $j` 257 337 done 258 338 fi 259 339 fi 260 340 done 341 + '' 342 + else ""} 343 + ''; 261 344 262 - ${toString (map (virtualHost: '' 263 - # Create webapps directory for the virtual host 264 - mkdir -p ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps 345 + script = '' 346 + ${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' 347 + ''; 265 348 266 - # Modify ownership 267 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps 349 + postStop = '' 350 + echo "Stopping tomcat..." 351 + CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh 352 + ''; 268 353 269 - # Symlink all the given web applications files or paths into the webapps/ directory 270 - # of this virtual host 271 - for i in "${if virtualHost ? webapps then toString virtualHost.webapps else ""}" 272 - do 273 - if [ -f $i ] 274 - then 275 - # If the given web application is a file, symlink it into the webapps/ directory 276 - ln -sfn $i ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps/`basename $i` 277 - elif [ -d $i ] 278 - then 279 - # If the given web application is a directory, then iterate over the files 280 - # in the special purpose directories and symlink them into the tomcat tree 281 - 282 - for j in $i/webapps/* 283 - do 284 - ln -sfn $j ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps/`basename $j` 285 - done 286 - 287 - # Also symlink the configuration files if they are included 288 - if [ -d $i/conf/Catalina ] 289 - then 290 - for j in $i/conf/Catalina/* 291 - do 292 - mkdir -p ${cfg.baseDir}/conf/Catalina/${virtualHost.name} 293 - ln -sfn $j ${cfg.baseDir}/conf/Catalina/${virtualHost.name}/`basename $j` 294 - done 295 - fi 296 - fi 297 - done 298 - 299 - '' 300 - ) cfg.virtualHosts) } 301 - 302 - # Create a work/ directory 303 - mkdir -p ${cfg.baseDir}/work 304 - chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/work 305 - 306 - ${if cfg.axis2.enable then 307 - '' 308 - # Copy the Axis2 web application 309 - cp -av ${pkgs.axis2}/webapps/axis2 ${cfg.baseDir}/webapps 310 - 311 - # Turn off addressing, which causes many errors 312 - sed -i -e 's%<module ref="addressing"/>%<!-- <module ref="addressing"/> -->%' ${cfg.baseDir}/webapps/axis2/WEB-INF/conf/axis2.xml 313 - 314 - # Modify permissions on the Axis2 application 315 - chown -R ${cfg.user}:${cfg.group} ${cfg.baseDir}/webapps/axis2 316 - 317 - # Symlink all the given web service files or paths into the webapps/axis2/WEB-INF/services directory 318 - for i in ${toString cfg.axis2.services} 319 - do 320 - if [ -f $i ] 321 - then 322 - # If the given web service is a file, symlink it into the webapps/axis2/WEB-INF/services 323 - ln -sfn $i ${cfg.baseDir}/webapps/axis2/WEB-INF/services/`basename $i` 324 - elif [ -d $i ] 325 - then 326 - # If the given web application is a directory, then iterate over the files 327 - # in the special purpose directories and symlink them into the tomcat tree 328 - 329 - for j in $i/webapps/axis2/WEB-INF/services/* 330 - do 331 - ln -sfn $j ${cfg.baseDir}/webapps/axis2/WEB-INF/services/`basename $j` 332 - done 333 - 334 - # Also symlink the configuration files if they are included 335 - if [ -d $i/conf/Catalina ] 336 - then 337 - for j in $i/conf/Catalina/* 338 - do 339 - ln -sfn $j ${cfg.baseDir}/conf/Catalina/localhost/`basename $j` 340 - done 341 - fi 342 - fi 343 - done 344 - '' 345 - else ""} 346 - ''; 347 - 348 - script = '' 349 - ${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' 350 - ''; 351 - 352 - postStop = 353 - '' 354 - echo "Stopping tomcat..." 355 - CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh 356 - ''; 357 - 358 - }; 354 + }; 359 355 360 356 }; 361 357
+7 -10
nixos/modules/services/x11/xfs.nix
··· 30 30 ###### implementation 31 31 32 32 config = mkIf config.services.xfs.enable { 33 - 34 33 assertions = singleton 35 34 { assertion = config.fonts.enableFontDir; 36 35 message = "Please enable fonts.enableFontDir to use the X Font Server."; 37 36 }; 38 37 39 - jobs.xfs = 40 - { description = "X Font Server"; 41 - 42 - startOn = "started networking"; 43 - 44 - exec = "${pkgs.xorg.xfs}/bin/xfs -config ${configFile}"; 45 - }; 46 - 38 + systemd.services.xfs = { 39 + description = "X Font Server"; 40 + after = [ "network.target" ]; 41 + wantedBy = [ "multi-user.target" ]; 42 + path = [ pkgs.xorg.xfs ]; 43 + script = "xfs -config ${configFile}"; 44 + }; 47 45 }; 48 - 49 46 }
-290
nixos/modules/system/upstart/upstart.nix
··· 1 - { config, lib, pkgs, ... }: 2 - 3 - with lib; 4 - with import ../boot/systemd-unit-options.nix { inherit config lib; }; 5 - 6 - let 7 - 8 - userExists = u: 9 - (u == "") || any (uu: uu.name == u) (attrValues config.users.extraUsers); 10 - 11 - groupExists = g: 12 - (g == "") || any (gg: gg.name == g) (attrValues config.users.extraGroups); 13 - 14 - makeJobScript = name: content: "${pkgs.writeScriptBin name content}/bin/${name}"; 15 - 16 - # From a job description, generate an systemd unit file. 17 - makeUnit = job: 18 - 19 - let 20 - hasMain = job.script != "" || job.exec != ""; 21 - 22 - env = job.environment; 23 - 24 - preStartScript = makeJobScript "${job.name}-pre-start" 25 - '' 26 - #! ${pkgs.stdenv.shell} -e 27 - ${job.preStart} 28 - ''; 29 - 30 - startScript = makeJobScript "${job.name}-start" 31 - '' 32 - #! ${pkgs.stdenv.shell} -e 33 - ${if job.script != "" then job.script else '' 34 - exec ${job.exec} 35 - ''} 36 - ''; 37 - 38 - postStartScript = makeJobScript "${job.name}-post-start" 39 - '' 40 - #! ${pkgs.stdenv.shell} -e 41 - ${job.postStart} 42 - ''; 43 - 44 - preStopScript = makeJobScript "${job.name}-pre-stop" 45 - '' 46 - #! ${pkgs.stdenv.shell} -e 47 - ${job.preStop} 48 - ''; 49 - 50 - postStopScript = makeJobScript "${job.name}-post-stop" 51 - '' 52 - #! ${pkgs.stdenv.shell} -e 53 - ${job.postStop} 54 - ''; 55 - in { 56 - 57 - inherit (job) description requires before partOf environment path restartIfChanged unitConfig; 58 - 59 - after = 60 - (if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else 61 - if job.startOn == "started udev" then [ "systemd-udev.service" ] else 62 - if job.startOn == "started network-interfaces" then [ "network-interfaces.target" ] else 63 - if job.startOn == "started networking" then [ "network.target" ] else 64 - if job.startOn == "ip-up" then [] else 65 - if job.startOn == "" || job.startOn == "startup" then [] else 66 - builtins.trace "Warning: job ‘${job.name}’ has unknown startOn value ‘${job.startOn}’." [] 67 - ) ++ job.after; 68 - 69 - wants = 70 - (if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else [] 71 - ) ++ job.wants; 72 - 73 - wantedBy = 74 - (if job.startOn == "" then [] else 75 - if job.startOn == "ip-up" then [ "ip-up.target" ] else 76 - [ "multi-user.target" ]) ++ job.wantedBy; 77 - 78 - serviceConfig = 79 - job.serviceConfig 80 - // optionalAttrs (job.preStart != "" && (job.script != "" || job.exec != "")) 81 - { ExecStartPre = preStartScript; } 82 - // optionalAttrs (job.preStart != "" && job.script == "" && job.exec == "") 83 - { ExecStart = preStartScript; } 84 - // optionalAttrs (job.script != "" || job.exec != "") 85 - { ExecStart = startScript; } 86 - // optionalAttrs (job.postStart != "") 87 - { ExecStartPost = postStartScript; } 88 - // optionalAttrs (job.preStop != "") 89 - { ExecStop = preStopScript; } 90 - // optionalAttrs (job.postStop != "") 91 - { ExecStopPost = postStopScript; } 92 - // (if job.script == "" && job.exec == "" then { Type = "oneshot"; RemainAfterExit = true; } else 93 - if job.daemonType == "fork" || job.daemonType == "daemon" then { Type = "forking"; GuessMainPID = true; } else 94 - if job.daemonType == "none" then { } else 95 - throw "invalid daemon type `${job.daemonType}'") 96 - // optionalAttrs (!job.task && !(job.script == "" && job.exec == "") && job.respawn) 97 - { Restart = "always"; } 98 - // optionalAttrs job.task 99 - { Type = "oneshot"; RemainAfterExit = false; }; 100 - }; 101 - 102 - 103 - jobOptions = serviceOptions // { 104 - 105 - name = mkOption { 106 - # !!! The type should ensure that this could be a filename. 107 - type = types.str; 108 - example = "sshd"; 109 - description = '' 110 - Name of the job, mapped to the systemd unit 111 - <literal><replaceable>name</replaceable>.service</literal>. 112 - ''; 113 - }; 114 - 115 - startOn = mkOption { 116 - #type = types.str; 117 - default = ""; 118 - description = '' 119 - The Upstart event that triggers this job to be started. Some 120 - are mapped to systemd dependencies; otherwise you will get a 121 - warning. If empty, the job will not start automatically. 122 - ''; 123 - }; 124 - 125 - stopOn = mkOption { 126 - type = types.str; 127 - default = "starting shutdown"; 128 - description = '' 129 - Ignored; this was the Upstart event that triggers this job to be stopped. 130 - ''; 131 - }; 132 - 133 - postStart = mkOption { 134 - type = types.lines; 135 - default = ""; 136 - description = '' 137 - Shell commands executed after the job is started (i.e. after 138 - the job's main process is started), but before the job is 139 - considered “running”. 140 - ''; 141 - }; 142 - 143 - preStop = mkOption { 144 - type = types.lines; 145 - default = ""; 146 - description = '' 147 - Shell commands executed before the job is stopped 148 - (i.e. before systemd kills the job's main process). This can 149 - be used to cleanly shut down a daemon. 150 - ''; 151 - }; 152 - 153 - postStop = mkOption { 154 - type = types.lines; 155 - default = ""; 156 - description = '' 157 - Shell commands executed after the job has stopped 158 - (i.e. after the job's main process has terminated). 159 - ''; 160 - }; 161 - 162 - exec = mkOption { 163 - type = types.str; 164 - default = ""; 165 - description = '' 166 - Command to start the job's main process. If empty, the 167 - job has no main process, but can still have pre/post-start 168 - and pre/post-stop scripts, and is considered “running” 169 - until it is stopped. 170 - ''; 171 - }; 172 - 173 - respawn = mkOption { 174 - type = types.bool; 175 - default = true; 176 - description = '' 177 - Whether to restart the job automatically if its process 178 - ends unexpectedly. 179 - ''; 180 - }; 181 - 182 - task = mkOption { 183 - type = types.bool; 184 - default = false; 185 - description = '' 186 - Whether this job is a task rather than a service. Tasks 187 - are executed only once, while services are restarted when 188 - they exit. 189 - ''; 190 - }; 191 - 192 - daemonType = mkOption { 193 - type = types.str; 194 - default = "none"; 195 - description = '' 196 - Determines how systemd detects when a daemon should be 197 - considered “running”. The value <literal>none</literal> means 198 - that the daemon is considered ready immediately. The value 199 - <literal>fork</literal> means that the daemon will fork once. 200 - The value <literal>daemon</literal> means that the daemon will 201 - fork twice. The value <literal>stop</literal> means that the 202 - daemon will raise the SIGSTOP signal to indicate readiness. 203 - ''; 204 - }; 205 - 206 - setuid = mkOption { 207 - type = types.addCheck types.str userExists; 208 - default = ""; 209 - description = '' 210 - Run the daemon as a different user. 211 - ''; 212 - }; 213 - 214 - setgid = mkOption { 215 - type = types.addCheck types.str groupExists; 216 - default = ""; 217 - description = '' 218 - Run the daemon as a different group. 219 - ''; 220 - }; 221 - 222 - path = mkOption { 223 - default = []; 224 - description = '' 225 - Packages added to the job's <envar>PATH</envar> environment variable. 226 - Both the <filename>bin</filename> and <filename>sbin</filename> 227 - subdirectories of each package are added. 228 - ''; 229 - }; 230 - 231 - }; 232 - 233 - 234 - upstartJob = { name, config, ... }: { 235 - 236 - options = { 237 - 238 - unit = mkOption { 239 - default = makeUnit config; 240 - description = "Generated definition of the systemd unit corresponding to this job."; 241 - }; 242 - 243 - }; 244 - 245 - config = { 246 - 247 - # The default name is the name extracted from the attribute path. 248 - name = mkDefault name; 249 - 250 - }; 251 - 252 - }; 253 - 254 - in 255 - 256 - { 257 - 258 - ###### interface 259 - 260 - options = { 261 - 262 - jobs = mkOption { 263 - default = {}; 264 - description = '' 265 - This option is a legacy method to define system services, 266 - dating from the era where NixOS used Upstart instead of 267 - systemd. You should use <option>systemd.services</option> 268 - instead. Services defined using <option>jobs</option> are 269 - mapped automatically to <option>systemd.services</option>, but 270 - may not work perfectly; in particular, most 271 - <option>startOn</option> conditions are not supported. 272 - ''; 273 - type = types.loaOf types.optionSet; 274 - options = [ jobOptions upstartJob ]; 275 - }; 276 - 277 - }; 278 - 279 - 280 - ###### implementation 281 - 282 - config = { 283 - 284 - systemd.services = 285 - flip mapAttrs' config.jobs (name: job: 286 - nameValuePair job.name job.unit); 287 - 288 - }; 289 - 290 - }
-8
nixos/modules/tasks/filesystems/btrfs.nix
··· 31 31 '' 32 32 btrfs device scan 33 33 ''; 34 - 35 - # !!! This is broken. There should be a udev rule to do this when 36 - # new devices are discovered. 37 - jobs.udev.postStart = 38 - '' 39 - ${pkgs.btrfs-progs}/bin/btrfs device scan 40 - ''; 41 - 42 34 }; 43 35 }
+20 -20
nixos/modules/virtualisation/libvirtd.nix
··· 166 166 ''; 167 167 }; 168 168 169 - jobs."libvirt-guests" = 170 - { description = "Libvirt Virtual Machines"; 169 + systemd.services."libvirt-guests" = { 170 + description = "Libvirt Virtual Machines"; 171 171 172 - wantedBy = [ "multi-user.target" ]; 173 - wants = [ "libvirtd.service" ]; 174 - after = [ "libvirtd.service" ]; 172 + wantedBy = [ "multi-user.target" ]; 173 + wants = [ "libvirtd.service" ]; 174 + after = [ "libvirtd.service" ]; 175 175 176 - restartIfChanged = false; 176 + restartIfChanged = false; 177 177 178 - path = [ pkgs.gettext pkgs.libvirt pkgs.gawk ]; 178 + path = with pkgs; [ gettext libvirt gawk ]; 179 179 180 - preStart = 181 - '' 182 - mkdir -p /var/lock/subsys -m 755 183 - ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests start || true 184 - ''; 180 + preStart = '' 181 + mkdir -p /var/lock/subsys -m 755 182 + ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests start || true 183 + ''; 185 184 186 - postStop = 187 - '' 188 - export PATH=${pkgs.gettext}/bin:$PATH 189 - export ON_SHUTDOWN=${cfg.onShutdown} 190 - ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop 191 - ''; 185 + postStop = '' 186 + export PATH=${pkgs.gettext}/bin:$PATH 187 + export ON_SHUTDOWN=${cfg.onShutdown} 188 + ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop 189 + ''; 192 190 193 - serviceConfig.Type = "oneshot"; 194 - serviceConfig.RemainAfterExit = true; 191 + serviceConfig = { 192 + Type = "oneshot"; 193 + RemainAfterExit = true; 195 194 }; 195 + }; 196 196 197 197 users.extraGroups.libvirtd.gid = config.ids.gids.libvirtd; 198 198
+3 -3
nixos/tests/quake3.nix
··· 34 34 { server = 35 35 { config, pkgs, ... }: 36 36 37 - { jobs."quake3-server" = 38 - { startOn = "startup"; 39 - exec = 37 + { systemd.services."quake3-server" = 38 + { wantedBy = [ "multi-user.target" ]; 39 + script = 40 40 "${pkgs.quake3demo}/bin/quake3-server '+set g_gametype 0' " + 41 41 "'+map q3dm7' '+addbot grunt' '+addbot daemia' 2> /tmp/log"; 42 42 };