* Tabs considered harmful.

svn path=/nixos/trunk/; revision=12407
This commit is contained in:
Eelco Dolstra 2008-07-23 14:13:27 +00:00
parent cc902c638c
commit 5ec1fa2060
21 changed files with 530 additions and 531 deletions

View File

@ -53,7 +53,7 @@ import ../helpers/make-etc.nix {
{ # Name Service Switch configuration file. Required by the C library.
source = if config.services.avahi.nssmdns
then (assert config.services.avahi.enable; ./nsswitch-mdns.conf)
else ./nsswitch.conf;
else ./nsswitch.conf;
target = "nsswitch.conf";
}

File diff suppressed because it is too large Load Diff

View File

@ -192,7 +192,7 @@ rec {
# Font aggregation
fontDir = import ./fontdir.nix {
inherit config pkgs ;
inherit config pkgs;
inherit (pkgs) builderDefs ttmkfdir;
inherit (pkgs.xorg) mkfontdir mkfontscale fontalias;
};
@ -330,17 +330,16 @@ rec {
bash = pkgs.bashInteractive;
adjustSetuidOwner = pkgs.lib.concatStrings (map
(_entry:let entry = {
(_entry: let entry = {
owner = "nobody";
group = "nogroup";
setuid = false;
setgid = false;
group = "nogroup";
setuid = false;
setgid = false;
} //_entry; in
''
chown ${entry.owner}.${entry.group} $wrapperDir/${entry.program}
chmod u${if entry.setuid then "+" else "-"}s $wrapperDir/${entry.program}
chmod g${if entry.setgid then "+" else "-"}s $wrapperDir/${entry.program}
chmod u${if entry.setuid then "+" else "-"}s $wrapperDir/${entry.program}
chmod g${if entry.setgid then "+" else "-"}s $wrapperDir/${entry.program}
'')
config.security.setuidOwners);
};
@ -411,7 +410,7 @@ rec {
config.nesting.children;
configurationName = config.boot.configurationName;
}) (pkgs.lib.getAttr ["environment" "checkConfigurationOptions"]
optionDeclarations.environment.checkConfigurationOptions.default
configuration)
optionDeclarations configuration ;
optionDeclarations.environment.checkConfigurationOptions.default
configuration)
optionDeclarations configuration;
}

View File

@ -26,23 +26,23 @@ let
(_entry:let entry={master=true;slaves=[];masters=[];}//_entry; in
''
zone "${entry.name}" {
type ${if entry.master then "master" else "slave"};
file "${entry.file}";
${ if entry.master then
''
allow-transfer {
${concatMapStrings (ip: ip+";\n") entry.slaves}
};
''
else
''
masters {
${concatMapStrings (ip: ip+";\n") entry.masters}
};
''
}
allow-query { any; };
};
type ${if entry.master then "master" else "slave"};
file "${entry.file}";
${ if entry.master then
''
allow-transfer {
${concatMapStrings (ip: ip+";\n") entry.slaves}
};
''
else
''
masters {
${concatMapStrings (ip: ip+";\n") entry.masters}
};
''
}
allow-query { any; };
};
''
)
cfg.zones

View File

@ -97,7 +97,7 @@ let
++ pkgs.lib.optional config.networking.enableIntel4965AGNFirmware pkgs.iwlwifi4965ucode
++ pkgs.lib.optional config.networking.enableZydasZD1211Firmware pkgs.zd1211fw
++ pkgs.lib.optional config.hardware.enableGo7007 "${kernelPackages.wis_go7007}/firmware"
++ config.services.udev.addFirmware;
++ config.services.udev.addFirmware;
extraUdevPkgs =
pkgs.lib.optional config.services.hal.enable pkgs.hal
++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007;
@ -349,10 +349,10 @@ let
(import ../upstart-jobs/dbus.nix {
inherit (pkgs) stdenv dbus;
dbusServices =
pkgs.lib.optional (config.services.hal.enable) pkgs.hal ++
pkgs.lib.optional (config.services.avahi.enable) pkgs.avahi ++
pkgs.lib.optional (config.services.disnix.enable) pkgs.disnix
;
pkgs.lib.optional config.services.hal.enable pkgs.hal ++
pkgs.lib.optional config.services.avahi.enable pkgs.avahi ++
pkgs.lib.optional config.services.disnix.enable pkgs.disnix
;
})
# HAL daemon.

View File

@ -7,12 +7,12 @@ cfg = config.services.disnix;
in
{
name = "disnix";
job = ''
description "Disnix server"
start on dbus
stop on shutdown
stop on shutdown
start script
# !!! quick hack: wait until dbus has started

View File

@ -49,8 +49,8 @@ let
confFile = pkgs.writeText "dovecot.conf" dovecotConf;
pamdFile = pkgs.writeText "dovecot.pam" ''
auth include common
account include common
auth include common
account include common
'';
in

View File

@ -7,7 +7,7 @@ cfg = config.services.ejabberd;
in
{
name = "ejabberd";
job = ''
description "EJabberd server"
@ -15,13 +15,13 @@ in
stop on network-interfaces/stop
start script
# Initialise state data
mkdir -p ${cfg.logsDir}
if ! test -d ${cfg.spoolDir}
then
cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib
fi
# Initialise state data
mkdir -p ${cfg.logsDir}
if ! test -d ${cfg.spoolDir}
then
cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib
fi
end script
respawn ${pkgs.bash}/bin/sh -c 'export PATH=$PATH:${pkgs.ejabberd}/sbin; cd ~; ejabberdctl --logs ${cfg.logsDir} --spool ${cfg.spoolDir} start; sleep 1d'

View File

@ -50,7 +50,7 @@ script
isPseudo=
if test \"$fsType\" = \"nfs\" || test \"$fsType\" = \"tmpfs\" ||
test \"$fsType\" = \"ext3cow\"; then isPseudo=1; fi
test \"$fsType\" = \"ext3cow\"; then isPseudo=1; fi
if ! test -n \"$isLabel\" -o -n \"$isPseudo\" -o -e \"$device\"; then
echo \"skipping $device, doesn't exist (yet)\"

View File

@ -1,27 +1,27 @@
{config, pkgs}:
let
cfg = config.services.gw6c;
procps = pkgs.procps;
gw6cService = import ../services/gw6c {
inherit (pkgs) stdenv gw6c coreutils
procps upstart iputils gnused
gnugrep seccureUser writeScript;
username = cfg.username;
password = cfg.password;
server = cfg.server;
keepAlive = cfg.keepAlive;
everPing = cfg.everPing;
cfg = config.services.gw6c;
procps = pkgs.procps;
gw6cService = import ../services/gw6c {
inherit (pkgs) stdenv gw6c coreutils
procps upstart iputils gnused
gnugrep seccureUser writeScript;
username = cfg.username;
password = cfg.password;
server = cfg.server;
keepAlive = cfg.keepAlive;
everPing = cfg.everPing;
seccureKeys = config.security.seccureKeys;
seccureKeys = config.security.seccureKeys;
waitPingableBroker = cfg.waitPingableBroker;
};
waitPingableBroker = cfg.waitPingableBroker;
};
in
{
name = "gw6c";
users = [];
groups = [];
job = "
name = "gw6c";
users = [];
groups = [];
job = "
description \"Gateway6 client\"
start on ${ if cfg.autorun then "network-interfaces/started" else "never" }

View File

@ -1,33 +1,33 @@
{config, pkgs}:
let
cfg = config.services.ircdHybrid;
ircdService = import ../services/ircd-hybrid {
stdenv = pkgs.stdenv;
inherit (pkgs) ircdHybrid coreutils
su iproute gnugrep procps;
serverName = cfg.serverName;
sid = cfg.sid;
description = cfg.description;
rsaKey = cfg.rsaKey;
certificate = cfg.certificate;
adminEmail = cfg.adminEmail;
extraIPs = cfg.extraIPs;
extraPort = cfg.extraPort;
gw6cEnabled = (config.services.gw6c.enable) &&
(config.services.gw6c.autorun);
};
cfg = config.services.ircdHybrid;
ircdService = import ../services/ircd-hybrid {
stdenv = pkgs.stdenv;
inherit (pkgs) ircdHybrid coreutils
su iproute gnugrep procps;
serverName = cfg.serverName;
sid = cfg.sid;
description = cfg.description;
rsaKey = cfg.rsaKey;
certificate = cfg.certificate;
adminEmail = cfg.adminEmail;
extraIPs = cfg.extraIPs;
extraPort = cfg.extraPort;
gw6cEnabled = (config.services.gw6c.enable) &&
(config.services.gw6c.autorun);
};
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
in
{
name = "ircd-hybrid";
users = [ {
name = "ircd";
description = "IRCD owner.";
} ];
groups = [{name = "ircd";}];
job = "
name = "ircd-hybrid";
users = [ {
name = "ircd";
description = "IRCD owner.";
} ];
groups = [{name = "ircd";}];
job = "
description = \"IRCD Hybrid server.\"
start on ${startingDependency}/started

View File

@ -4,18 +4,18 @@ let
cfg = config.services.jboss;
jbossService = import ../services/jboss {
inherit (pkgs) stdenv jboss su;
inherit (cfg) tempDir logDir libUrl deployDir serverDir user useJK;
inherit (pkgs) stdenv jboss su;
inherit (cfg) tempDir logDir libUrl deployDir serverDir user useJK;
};
in
{
name = "jboss";
job = "
name = "jboss";
job = "
description \"JBoss server\"
stop on shutdown
respawn ${jbossService}/bin/control start
";
";
}

View File

@ -26,7 +26,7 @@ start script
if ! test -f "${hostKey}"
then
${lsh}/bin/lsh-keygen --server | \
${lsh}/bin/lsh-writekey --server -o "${hostKey}"
${lsh}/bin/lsh-writekey --server -o "${hostKey}"
fi
end script
@ -47,7 +47,7 @@ respawn ${lsh}/sbin/lshd --daemonic \
--subsystems=${concatStringsSep ","
(map (pair: (head pair) + "=" +
(head (tail pair)))
subsystems)}
subsystems)}
'';
}

View File

@ -26,8 +26,8 @@ with pkgs;
mkdir /etc/openfire || true
for i in ${openfire}/conf.inst/*; do
if ! test -f /etc/openfire/$(basename $i); then
cp $i /etc/openfire/
fi
cp $i /etc/openfire/
fi
done
openfire start
end script

View File

@ -138,13 +138,13 @@ in
${pkgs.coreutils}/bin/mkdir -p /var/spool/mail /var/postfix/conf /var/postfix/queue
fi
${pkgs.coreutils}/bin/chown -R ${user}.${group} /var/postfix
${pkgs.coreutils}/bin/chown -R ${user}.${setgidGroup} /var/postfix/queue
${pkgs.coreutils}/bin/chmod -R ug+rwX /var/postfix/queue
${pkgs.coreutils}/bin/chown root.root /var/spool/mail
${pkgs.coreutils}/bin/chmod a+rwxt /var/spool/mail
${pkgs.coreutils}/bin/chown -R ${user}.${group} /var/postfix
${pkgs.coreutils}/bin/chown -R ${user}.${setgidGroup} /var/postfix/queue
${pkgs.coreutils}/bin/chmod -R ug+rwX /var/postfix/queue
${pkgs.coreutils}/bin/chown root.root /var/spool/mail
${pkgs.coreutils}/bin/chmod a+rwxt /var/spool/mail
ln -sf ${pkgs.postfix}/share/postfix/conf/* /var/postfix/conf
ln -sf ${pkgs.postfix}/share/postfix/conf/* /var/postfix/conf
ln -sf ${aliasesFile} /var/postfix/conf/aliases
ln -sf ${mainCfFile} /var/postfix/conf/main.cf

View File

@ -36,7 +36,7 @@ in
start script
if ! test -e ${cfg.dataDir}; then
mkdir -m 0700 -p ${cfg.dataDir}
mkdir -m 0700 -p ${cfg.dataDir}
chown -R postgres ${cfg.dataDir}
${run} -c '${postgresql}/bin/initdb -D ${cfg.dataDir} -U root'
fi

View File

@ -28,56 +28,56 @@ in
stop on network-interfaces/stop
start script
# Create initial state data
if ! test -d ${cfg.baseDir}
then
mkdir -p ${cfg.baseDir}/webapps
mkdir -p ${cfg.baseDir}/shared
cp -av ${pkgs.tomcat6}/{conf,temp,logs} ${cfg.baseDir}
fi
# Deploy all webapplications
if ! test "${cfg.deployFrom}" = ""
then
rm -rf ${cfg.baseDir}/webapps
mkdir -p ${cfg.baseDir}/webapps
for i in ${cfg.deployFrom}/*
do
cp -rL $i ${cfg.baseDir}/webapps
done
fi
# Fix permissions
chown -R ${cfg.user} ${cfg.baseDir}
for i in `find ${cfg.baseDir} -type d`
do
chmod -v 755 $i
done
for i in `find ${cfg.baseDir} -type f`
do
chmod -v 644 $i
done
# Create initial state data
if ! test -d ${cfg.baseDir}
then
mkdir -p ${cfg.baseDir}/webapps
mkdir -p ${cfg.baseDir}/shared
cp -av ${pkgs.tomcat6}/{conf,temp,logs} ${cfg.baseDir}
fi
# Deploy all webapplications
if ! test "${cfg.deployFrom}" = ""
then
rm -rf ${cfg.baseDir}/webapps
mkdir -p ${cfg.baseDir}/webapps
for i in ${cfg.deployFrom}/*
do
cp -rL $i ${cfg.baseDir}/webapps
done
fi
# Fix permissions
chown -R ${cfg.user} ${cfg.baseDir}
for i in `find ${cfg.baseDir} -type d`
do
chmod -v 755 $i
done
for i in `find ${cfg.baseDir} -type f`
do
chmod -v 644 $i
done
# Deploy all shared libraries
if ! test "${cfg.sharedLibFrom}" = ""
then
rm -f ${cfg.baseDir}/shared/lib
ln -s ${cfg.sharedLibFrom} ${cfg.baseDir}/shared/lib
fi
# Deploy all shared libraries
if ! test "${cfg.sharedLibFrom}" = ""
then
rm -f ${cfg.baseDir}/shared/lib
ln -s ${cfg.sharedLibFrom} ${cfg.baseDir}/shared/lib
fi
end script
respawn ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} JAVA_OPTS="${cfg.javaOpts}" ${pkgs.tomcat6}/bin/startup.sh; sleep 1d'
stop script
echo "Stopping tomcat..."
CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${pkgs.tomcat6}/bin/shutdown.sh
echo "Stopping tomcat..."
CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${pkgs.tomcat6}/bin/shutdown.sh
end script
'';
}

View File

@ -26,32 +26,32 @@ rec {
start script
# Critical: tell the kernel where to find splash_helper. It calls
# this program every time we switch between consoles.
echo ${splashutils}/${splashutils.helperName} > ${splashutils.helperProcFile}
# Critical: tell the kernel where to find splash_helper. It calls
# this program every time we switch between consoles.
echo ${splashutils}/${splashutils.helperName} > ${splashutils.helperProcFile}
# For each console...
for tty in ${toString (map (x: x.tty) backgrounds)}; do
# Make sure that the console exists.
echo -n "" > /dev/tty$tty
# For each console...
for tty in ${toString (map (x: x.tty) backgrounds)}; do
# Make sure that the console exists.
echo -n "" > /dev/tty$tty
# Set the theme as determined by tty-backgrounds-combine.sh
# above.
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/${splashutils.controlName} --tty $tty -c setcfg -t $theme || true
${splashutils}/${splashutils.controlName} --tty $tty -c setpic -t $theme || true
${splashutils}/${splashutils.controlName} --tty $tty -c on || true
done
# Set the theme as determined by tty-backgrounds-combine.sh
# above.
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/${splashutils.controlName} --tty $tty -c setcfg -t $theme || true
${splashutils}/${splashutils.controlName} --tty $tty -c setpic -t $theme || true
${splashutils}/${splashutils.controlName} --tty $tty -c on || true
done
end script
respawn sleep 10000 # !!! Hack
stop script
# Disable the theme on each console.
for tty in ${toString (map (x: x.tty) backgrounds)}; do
${splashutils}/${splashutils.controlName} --tty $tty -c off || true
done
# Disable the theme on each console.
for tty in ${toString (map (x: x.tty) backgrounds)}; do
${splashutils}/${splashutils.controlName} --tty $tty -c off || true
done
end script
'';

View File

@ -19,7 +19,7 @@ let
# Miscellaneous devices.
KERNEL=="sonypi", MODE="0666"
KERNEL=="kvm", MODE="0666"
KERNEL=="kqemu", NAME="%k", MODE="0666"
KERNEL=="kqemu", NAME="%k", MODE="0666"
# Create a symlink for the CD-ROM device.
#KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k"
@ -51,11 +51,11 @@ let
''
substituteInPlace $out/80-drivers.rules \
--replace /sbin/modprobe ${modprobe}/sbin/modprobe
''
else
''
rm $out/80-drivers.rules
''
''
else
''
rm $out/80-drivers.rules
''
}
for i in ${toString extraUdevPkgs}; do
for j in $i/etc/udev/rules.d/*; do
@ -92,10 +92,10 @@ in
env UDEV_CONFIG_FILE=${conf}
start script
echo "" > /proc/sys/kernel/hotplug
echo "" > /proc/sys/kernel/hotplug
# Get rid of possible old udev processes.
${procps}/bin/pkill -u root "^udevd$" || true
# Get rid of possible old udev processes.
${procps}/bin/pkill -u root "^udevd$" || true
# Do the loading of additional stage 2 kernel modules.
# Maybe this isn't the best place...
@ -104,30 +104,30 @@ in
${modprobe}/sbin/modprobe $i || true
done
# Start udev.
${udev}/sbin/udevd --daemon
# Start udev.
${udev}/sbin/udevd --daemon
# Let udev create device nodes for all modules that have already
# been loaded into the kernel (or for which support is built into
# the kernel).
if ! test -e ${devicesCreated}; then
${udev}/sbin/udevadm trigger
${udev}/sbin/udevadm settle # wait for udev to finish
touch ${devicesCreated}
fi
# Let udev create device nodes for all modules that have already
# been loaded into the kernel (or for which support is built into
# the kernel).
if ! test -e ${devicesCreated}; then
${udev}/sbin/udevadm trigger
${udev}/sbin/udevadm settle # wait for udev to finish
touch ${devicesCreated}
fi
# Kill udev, let Upstart restart and monitor it. (This is nasty,
# but we have to run `udevadm trigger' first. Maybe we can use
# Upstart's `binary' keyword, but it isn't implemented yet.)
if ! ${procps}/bin/pkill -u root "^udevd$"; then
echo "couldn't stop udevd"
fi
# Kill udev, let Upstart restart and monitor it. (This is nasty,
# but we have to run `udevadm trigger' first. Maybe we can use
# Upstart's `binary' keyword, but it isn't implemented yet.)
if ! ${procps}/bin/pkill -u root "^udevd$"; then
echo "couldn't stop udevd"
fi
while ${procps}/bin/pgrep -u root "^udevd$"; do
sleep 1
done
while ${procps}/bin/pgrep -u root "^udevd$"; do
sleep 1
done
initctl emit new-devices
initctl emit new-devices
end script
respawn ${udev}/sbin/udevd

View File

@ -1,20 +1,20 @@
{
pkgs, config
pkgs, config
}:
if ! config.fonts.enableFontDir then abort "Please enable fontDir (fonts.enableFontDir) to use xfs." else
let
configFile = ./xfs.conf;
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
name = "xfs";
groups = [];
users = [];
job = "
description \"X Font Server\"
start on ${startingDependency}/started
stop on shutdown
respawn ${pkgs.xorg.xfs}/bin/xfs -config ${configFile}
";
respawn ${pkgs.xorg.xfs}/bin/xfs -config ${configFile}
";
}

View File

@ -98,7 +98,7 @@ let
if cfg.useInternalAGPGART == "yes" then
'' Option "UseInternalAGPGART" "yes"''
else if cfg.useInternalAGPGART == "no" then
'' Option "UseInternalAGPGART" "no"''
'' Option "UseInternalAGPGART" "no"''
else "";
extraDeviceConfig = cfg.extraDeviceConfig;
@ -141,7 +141,7 @@ let
export screen='
Option "AddARGBGLXVisuals" "true"
Option "DisableGLXRootClipping" "true"
Option "RandRRotation" "on"
Option "RandRRotation" "on"
'
export device='
@ -154,7 +154,7 @@ let
Option "Composite" "Enable"
'
fi
if [ "${toString videoDriver}" = i810 ]; then
export extensions='
Option "Composite" "Enable"
@ -385,7 +385,7 @@ rec {
then ''
ln -sf ${kernelPackages.nvidiaDrivers} /var/run/opengl-driver
''
else if cfg.driSupport
else if cfg.driSupport
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
else ""
}