From aa786904653d9bcad35fcc67c86dc9ad34ca3bbc Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 6 Mar 2009 12:26:57 +0000 Subject: [PATCH] Convert "xfs", problems when enabling warning! svn path=/nixos/branches/fix-style/; revision=14388 --- system/options.nix | 13 +------- upstart-jobs/default.nix | 6 ---- upstart-jobs/xfs.nix | 64 ++++++++++++++++++++++++++++++---------- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/system/options.nix b/system/options.nix index 69ec7553c25..5d7c546be27 100644 --- a/system/options.nix +++ b/system/options.nix @@ -479,18 +479,6 @@ in }; - xfs = { - - enable = mkOption { - default = false; - description = " - Whether to enable the X Font Server. - "; - }; - - }; - - mysql = { enable = mkOption { default = false; @@ -901,6 +889,7 @@ in (import ../upstart-jobs/udev.nix) # The udev daemon creates devices nodes and runs programs when hardware events occur. (import ../upstart-jobs/samba.nix) # TODO: doesn't start here (?) (import ../upstart-jobs/ircd-hybrid.nix) # TODO: doesn't compile on x86_64-linux, can't test + (import ../upstart-jobs/xfs.nix) # nix (import ../upstart-jobs/nix.nix) # nix options and daemon diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 116f6e1b79a..9030af83e4b 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -149,12 +149,6 @@ let inherit config pkgs; }) - # X Font Server - ++ optional config.services.xfs.enable - (import ../upstart-jobs/xfs.nix { - inherit config pkgs; - }) - # Postfix mail server. ++ optional config.services.postfix.enable (import ../upstart-jobs/postfix.nix { diff --git a/upstart-jobs/xfs.nix b/upstart-jobs/xfs.nix index 1b36002a348..c7b9d85551d 100644 --- a/upstart-jobs/xfs.nix +++ b/upstart-jobs/xfs.nix @@ -1,20 +1,54 @@ -{ - pkgs, config -}: -if ! config.fonts.enableFontDir then abort "Please enable fontDir (fonts.enableFontDir) to use xfs." else +{pkgs, config, ...}: + +###### interface let - configFile = ./xfs.conf; + inherit (pkgs.lib) mkOption mkIf; + + options = { + services = { + xfs = { + + enable = mkOption { + default = false; + description = " + Whether to enable the X Font Server. + "; + }; + + }; + }; + }; +in + +###### implementation + + +# FIXME: enable this warning again. It's causing "infinite recursion encountered, why?" +# if ! config.fonts.enableFontDir then throw "Please enable fontDir (fonts.enableFontDir) to use xfs." else + +let + configFile = ./xfs.conf; startingDependency = if config.services.gw6c.enable && config.services.gw6c.autorun then "gw6c" else "network-interfaces"; in -rec { - name = "xfs"; - groups = []; - users = []; - job = " - description \"X Font Server\" - start on ${startingDependency}/started - stop on shutdown - respawn ${pkgs.xorg.xfs}/bin/xfs -config ${configFile} - "; +mkIf config.services.xfs.enable { + require = [ + options + ]; + + services = { + + extraJobs = [ (rec { + name = "xfs"; + groups = []; + users = []; + job = '' + description "X Font Server" + start on ${startingDependency}/started + stop on shutdown + + respawn ${pkgs.xorg.xfs}/bin/xfs -config ${configFile} + ''; + })]; + }; }