···149 # not be started by default on the installation CD because the
150 # default root password is empty.
151 services.openssh.enable = true;
152-153- jobs.openssh.startOn = lib.mkOverride 50 "";
154155 boot.loader.grub.enable = false;
156 boot.loader.generationsDir.enable = false;
···149 # not be started by default on the installation CD because the
150 # default root password is empty.
151 services.openssh.enable = true;
152+ systemd.services.openssh.wantedBy = lib.mkOverride 50 [];
0153154 boot.loader.grub.enable = false;
155 boot.loader.generationsDir.enable = false;
···164 # not be started by default on the installation CD because the
165 # default root password is empty.
166 services.openssh.enable = true;
167- jobs.openssh.startOn = lib.mkOverride 50 "";
168169 # cpufrequtils fails to build on non-pc
170 powerManagement.enable = false;
···164 # not be started by default on the installation CD because the
165 # default root password is empty.
166 services.openssh.enable = true;
167+ systemd.services.openssh.wantedBy = lib.mkOverride 50 [];
168169 # cpufrequtils fails to build on non-pc
170 powerManagement.enable = false;
···127 extraGroups = cfg.extraGroups;
128 };
129130- jobs.tomcat =
131- { description = "Apache Tomcat server";
000132133- startOn = "started network-interfaces";
134- stopOn = "stopping network-interfaces";
0135136- daemonType = "daemon";
0137138- preStart =
139- ''
140- # Create the base directory
141- mkdir -p ${cfg.baseDir}
142143- # Create a symlink to the bin directory of the tomcat component
144- ln -sfn ${tomcat}/bin ${cfg.baseDir}/bin
000000000000145146- # Create a conf/ directory
147- mkdir -p ${cfg.baseDir}/conf
148- chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/conf
0149150- # 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
000155156- # Create subdirectory for virtual hosts
157- mkdir -p ${cfg.baseDir}/virtualhosts
0158159- # 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
164165- # 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
169170- # 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 ''''}
178179- # Create a temp/ directory
180- mkdir -p ${cfg.baseDir}/temp
181- chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/temp
00000000182183- # Create a lib/ directory
184- mkdir -p ${cfg.baseDir}/lib
185- chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/lib
000186187- # Create a shared/lib directory
188- mkdir -p ${cfg.baseDir}/shared/lib
189- chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/shared/lib
00000000190191- # Create a webapps/ directory
192- mkdir -p ${cfg.baseDir}/webapps
193- chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/webapps
000194195- # 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
206207- for j in $i/lib/*
208- do
209- ln -sfn $j ${cfg.baseDir}/lib/`basename $j`
210- done
211- fi
212- done
213214- # 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 ]
218 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/*
227 do
228- ln -sfn $j ${cfg.baseDir}/shared/lib/`basename $j`
0229 done
230 fi
231- done
00000000000000000000000000000000000000000000000000000232233- # Symlink all the given web applications files or paths into the webapps/ directory
234- for i in ${toString cfg.webapps}
000235 do
236 if [ -f $i ]
237 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`
240 elif [ -d $i ]
241 then
242 # If the given web application is a directory, then iterate over the files
243 # in the special purpose directories and symlink them into the tomcat tree
244245- for j in $i/webapps/*
246 do
247- ln -sfn $j ${cfg.baseDir}/webapps/`basename $j`
248 done
249250 # Also symlink the configuration files if they are included
···252 then
253 for j in $i/conf/Catalina/*
254 do
255- mkdir -p ${cfg.baseDir}/conf/Catalina/localhost
256 ln -sfn $j ${cfg.baseDir}/conf/Catalina/localhost/`basename $j`
257 done
258 fi
259 fi
260 done
000261262- ${toString (map (virtualHost: ''
263- # Create webapps directory for the virtual host
264- mkdir -p ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps
265266- # Modify ownership
267- chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/virtualhosts/${virtualHost.name}/webapps
00268269- # 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- };
359360 };
361
···127 extraGroups = cfg.extraGroups;
128 };
129130+ systemd.services.tomcat = {
131+ description = "Apache Tomcat server";
132+ wantedBy = [ "multi-user.target" ];
133+ after = [ "network-interfaces.target" ];
134+ serviceConfig.Type = "daemon";
135136+ preStart = ''
137+ # Create the base directory
138+ mkdir -p ${cfg.baseDir}
139140+ # Create a symlink to the bin directory of the tomcat component
141+ ln -sfn ${tomcat}/bin ${cfg.baseDir}/bin
142143+ # Create a conf/ directory
144+ mkdir -p ${cfg.baseDir}/conf
145+ chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/conf
0146147+ # 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
161162+ # 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
166167+ # 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 ''''}
175176+ # Create a temp/ directory
177+ mkdir -p ${cfg.baseDir}/temp
178+ chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/temp
179180+ # Create a lib/ directory
181+ mkdir -p ${cfg.baseDir}/lib
182+ chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/lib
00183184+ # Create a shared/lib directory
185+ mkdir -p ${cfg.baseDir}/shared/lib
186+ chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/shared/lib
0187188+ # Create a webapps/ directory
189+ mkdir -p ${cfg.baseDir}/webapps
190+ chown ${cfg.user}:${cfg.group} ${cfg.baseDir}/webapps
00000191192+ # 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
203204+ for j in $i/lib/*
205+ do
206+ ln -sfn $j ${cfg.baseDir}/lib/`basename $j`
207+ done
208+ fi
209+ done
210211+ # 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
222223+ for j in $i/shared/lib/*
224+ do
225+ ln -sfn $j ${cfg.baseDir}/shared/lib/`basename $j`
226+ done
227+ fi
228+ done
229230+ # 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
241242+ for j in $i/webapps/*
243+ do
244+ ln -sfn $j ${cfg.baseDir}/webapps/`basename $j`
245+ done
00246247+ # Also symlink the configuration files if they are included
248+ if [ -d $i/conf/Catalina ]
00249 then
250+ for j in $i/conf/Catalina/*
0000000251 do
252+ mkdir -p ${cfg.baseDir}/conf/Catalina/localhost
253+ ln -sfn $j ${cfg.baseDir}/conf/Catalina/localhost/`basename $j`
254 done
255 fi
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
310311+ # 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}
316 do
317 if [ -f $i ]
318 then
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`
321 elif [ -d $i ]
322 then
323 # If the given web application is a directory, then iterate over the files
324 # in the special purpose directories and symlink them into the tomcat tree
325326+ for j in $i/webapps/axis2/WEB-INF/services/*
327 do
328+ ln -sfn $j ${cfg.baseDir}/webapps/axis2/WEB-INF/services/`basename $j`
329 done
330331 # Also symlink the configuration files if they are included
···333 then
334 for j in $i/conf/Catalina/*
335 do
0336 ln -sfn $j ${cfg.baseDir}/conf/Catalina/localhost/`basename $j`
337 done
338 fi
339 fi
340 done
341+ ''
342+ else ""}
343+ '';
344345+ 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+ '';
348349+ 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+ '';
353354+ };
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000355356 };
357
+7-10
nixos/modules/services/x11/xfs.nix
···30 ###### implementation
3132 config = mkIf config.services.xfs.enable {
33-34 assertions = singleton
35 { assertion = config.fonts.enableFontDir;
36 message = "Please enable fonts.enableFontDir to use the X Font Server.";
37 };
3839- jobs.xfs =
40- { description = "X Font Server";
41-42- startOn = "started networking";
43-44- exec = "${pkgs.xorg.xfs}/bin/xfs -config ${configFile}";
45- };
46-47 };
48-49}
···31 ''
32 btrfs device scan
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 };
43}