Author: viric
Date: Fri Nov 26 14:16:12 2010
New Revision: 24871
URL: https://svn.nixos.org/websvn/nix/?rev=24871&sc=1
Log:
Updating from trunk (specially for the enableFontDir option, as it was not up
to date for nixpkgs)
Added:
nixos/branches/stdenv-updates/modules/misc/deployment.nix
- copied unchanged from r24870, nixos/trunk/modules/misc/deployment.nix
Modified:
nixos/branches/stdenv-updates/ (props changed)
nixos/branches/stdenv-updates/lib/eval-config.nix
nixos/branches/stdenv-updates/modules/config/fonts.nix
nixos/branches/stdenv-updates/modules/installer/tools/nixos-option.sh
nixos/branches/stdenv-updates/modules/misc/ids.nix
nixos/branches/stdenv-updates/modules/misc/nixpkgs.nix
nixos/branches/stdenv-updates/modules/module-list.nix
nixos/branches/stdenv-updates/modules/programs/bash/bashrc.sh
nixos/branches/stdenv-updates/modules/services/backup/mysql-backup.nix
nixos/branches/stdenv-updates/modules/services/databases/postgresql.nix
nixos/branches/stdenv-updates/modules/services/misc/disnix.nix
nixos/branches/stdenv-updates/modules/services/monitoring/monit.nix
nixos/branches/stdenv-updates/modules/services/network-filesystems/nfs-kernel.nix
nixos/branches/stdenv-updates/modules/services/networking/dhclient.nix
nixos/branches/stdenv-updates/modules/services/web-servers/tomcat.nix
nixos/branches/stdenv-updates/modules/services/x11/display-managers/kdm.nix
nixos/branches/stdenv-updates/modules/tasks/network-interfaces.nix
nixos/branches/stdenv-updates/modules/tasks/tty-backgrounds.nix
Modified: nixos/branches/stdenv-updates/lib/eval-config.nix
==============================================================================
--- nixos/branches/stdenv-updates/lib/eval-config.nix Fri Nov 26 14:12:10
2010 (r24870)
+++ nixos/branches/stdenv-updates/lib/eval-config.nix Fri Nov 26 14:16:12
2010 (r24871)
@@ -11,7 +11,7 @@
, modules
}:
-let extraArgs_ = extraArgs; pkgs_ = pkgs; in
+let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in
rec {
@@ -39,7 +39,8 @@
# Import Nixpkgs, allowing the NixOS option nixpkgs.config to
# specify the Nixpkgs configuration (e.g., to set package options
# such as firefox.enableGeckoMediaPlayer, or to apply global
- # overrides such as changing GCC throughout the system). This is
+ # overrides such as changing GCC throughout the system), and the
+ # option nixpkgs.system to override the platform type. This is
# tricky, because we have to prevent an infinite recursion: "pkgs"
# is passed as an argument to NixOS modules, but the value of "pkgs"
# depends on config.nixpkgs.config, which we get from the modules.
@@ -50,12 +51,13 @@
then pkgs_
else import nixpkgs (
let
+ system = if nixpkgsOptions.system != "" then nixpkgsOptions.system
else system_;
nixpkgsOptions = (import ./eval-config.nix {
inherit system nixpkgs services extraArgs modules;
# For efficiency, leave out most NixOS modules; they don't
# define nixpkgs.config, so it's pointless to evaluate them.
baseModules = [ ../modules/misc/nixpkgs.nix ];
- pkgs = import nixpkgs { inherit system; config = {}; };
+ pkgs = import nixpkgs { system = system_; config = {}; };
}).optionDefinitions.nixpkgs;
in
{
Modified: nixos/branches/stdenv-updates/modules/config/fonts.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/config/fonts.nix Fri Nov 26
14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/config/fonts.nix Fri Nov 26
14:16:12 2010 (r24871)
@@ -98,7 +98,7 @@
###### implementation
let
- inherit (pkgs) builderDefs ttmkfdir;
+ inherit (pkgs) builderDefs;
inherit (pkgs.xorg) mkfontdir mkfontscale fontalias;
fontDirs = config.fonts.fonts;
@@ -107,7 +107,7 @@
localDefs = with builderDefs; builderDefs.passthru.function rec {
src = "";/* put a fetchurl here */
- buildInputs = [mkfontdir mkfontscale ttmkfdir];
+ buildInputs = [mkfontdir mkfontscale];
configureFlags = [];
inherit fontDirs;
installPhase = fullDepEntry ("
@@ -135,13 +135,6 @@
rm fonts.alias
mkfontdir
mkfontscale
- mv fonts.scale fonts.scale.old
- mv fonts.dir fonts.dir.old
- ttmkfdir
- cat fonts.scale.old >> fonts.scale
- cat fonts.dir.old >> fonts.dir
- rm fonts.dir.old
- rm fonts.scale.old
cat \$( find ${fontalias}/ -name fonts.alias) >fonts.alias
") ["minInit" "addInputs"];
};
Modified: nixos/branches/stdenv-updates/modules/installer/tools/nixos-option.sh
==============================================================================
--- nixos/branches/stdenv-updates/modules/installer/tools/nixos-option.sh
Fri Nov 26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/installer/tools/nixos-option.sh
Fri Nov 26 14:16:12 2010 (r24871)
@@ -66,13 +66,14 @@
sarg="$arg"
while test "$sarg" != "-"; do
case $sarg in
- --*) longarg=$arg;;
+ --*) longarg=$arg; sarg="--";;
-d*) longarg="$longarg --description";;
-v*) longarg="$longarg --value";;
-l*) longarg="$longarg --lookup";;
-i*) longarg="$longarg --install";;
-*) usage;;
esac
+ # remove the first letter option
sarg="-${sarg#??}"
done
;;
Copied: nixos/branches/stdenv-updates/modules/misc/deployment.nix (from r24870,
nixos/trunk/modules/misc/deployment.nix)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ nixos/branches/stdenv-updates/modules/misc/deployment.nix Fri Nov 26
14:16:12 2010 (r24871, copy of r24870,
nixos/trunk/modules/misc/deployment.nix)
@@ -0,0 +1,23 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+ options = {
+
+ deployment = mkOption {
+ description = ''
+ This option captures various custom attributes related to the
configuration of the system, which
+ are not directly used for building a system configuration. Usually
these attributes
+ are used by external tooling, such as the nixos-deploy-network tool or
the Disnix Avahi
+ publisher.
+ '';
+ default = {};
+ example = {
+ description = "My production machine";
+ hostname = "my.test.org";
+ country = "NL";
+ };
+ };
+ };
+}
Modified: nixos/branches/stdenv-updates/modules/misc/ids.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/misc/ids.nix Fri Nov 26 14:12:10
2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/misc/ids.nix Fri Nov 26 14:16:12
2010 (r24871)
@@ -57,6 +57,7 @@
cups = 36;
foldingAtHome = 37;
sabnzbd = 38;
+ kdm = 39;
# When adding a uid, make sure it doesn't match an existing gid.
nixbld = 30000; # start of range of uids
Modified: nixos/branches/stdenv-updates/modules/misc/nixpkgs.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/misc/nixpkgs.nix Fri Nov 26
14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/misc/nixpkgs.nix Fri Nov 26
14:16:12 2010 (r24871)
@@ -13,5 +13,16 @@
'';
};
+ nixpkgs.system = pkgs.lib.mkOption {
+ default = "";
+ description = ''
+ Specifies the Nix platform type for which NixOS should be built.
+ If unset, it defaults to the platform type of your host system
+ (<literal>${builtins.currentSystem}</literal>).
+ Specifying this option is useful when doing distributed
+ multi-platform deployment, or when building virtual machines.
+ '';
+ };
+
};
}
Modified: nixos/branches/stdenv-updates/modules/module-list.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/module-list.nix Fri Nov 26
14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/module-list.nix Fri Nov 26
14:16:12 2010 (r24871)
@@ -24,6 +24,7 @@
./installer/tools/tools.nix
./misc/assertions.nix
./misc/check-config.nix
+ ./misc/deployment.nix
./misc/ids.nix
./misc/locate.nix
./misc/nixpkgs.nix
Modified: nixos/branches/stdenv-updates/modules/programs/bash/bashrc.sh
==============================================================================
--- nixos/branches/stdenv-updates/modules/programs/bash/bashrc.sh Fri Nov
26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/programs/bash/bashrc.sh Fri Nov
26 14:16:12 2010 (r24871)
@@ -68,7 +68,7 @@
alias ls="ls --color=tty"
alias ll="ls -l"
alias l="ls -alh"
-alias which="type -p"
+alias which="type -P"
# The "non-interactive" Bash build does not support programmable
# completion so check whether it's available.
Modified: nixos/branches/stdenv-updates/modules/services/backup/mysql-backup.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/backup/mysql-backup.nix
Fri Nov 26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/backup/mysql-backup.nix
Fri Nov 26 14:16:12 2010 (r24871)
@@ -6,10 +6,10 @@
inherit (pkgs) mysql gzip;
- location = config.services.mysqlBackup.location ;
-
+ cfg = config.services.mysqlBackup ;
+ location = cfg.location ;
mysqlBackupCron = db : ''
- ${config.services.mysqlBackup.period} ${config.services.mysqlBackup.user}
${mysql}/bin/mysqldump ${db} | ${gzip}/bin/gzip -c > ${location}/${db}.gz
+ ${cfg.period} ${cfg.user} ${mysql}/bin/mysqldump ${if
cfg.singleTransaction then "--single-transaction" else ""} ${db} |
${gzip}/bin/gzip -c > ${location}/${db}.gz
'';
in
@@ -55,6 +55,13 @@
Location to put the gzipped MySQL database dumps.
'';
};
+
+ singleTransaction = mkOption {
+ default = false;
+ description = ''
+ Whether to create database dump in a single transaction
+ '';
+ };
};
};
Modified:
nixos/branches/stdenv-updates/modules/services/databases/postgresql.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/databases/postgresql.nix
Fri Nov 26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/databases/postgresql.nix
Fri Nov 26 14:16:12 2010 (r24871)
@@ -9,22 +9,16 @@
# see description of extraPlugins
postgresqlAndPlugins = pg:
if cfg.extraPlugins == [] then pg
- else pkgs.runCommand "postgresql-and-plugins" {
- inherit (pkgs) perl;
- inherit pg;
- # used by env builder:
+ else pkgs.buildEnv {
+ name = "postgresql-and-plugins";
paths = [ pg ] ++ cfg.extraPlugins;
- pathsToLink = "/";
- ignoreCollisions = 0;
- manifest = null;
- }
- ''
- perlScript=${pkgs.buildEnvScript}
- mkdir -p $out/bin
- $perl/bin/perl $perlScript
- rm $out/bin/{pg_config,postgres,pg_ctl}
- cp --target-directory=$out/bin $pg/bin/{postgres,pg_config,pg_ctl}
- '';
+ postBuild =
+ ''
+ mkdir -p $out/bin
+ rm $out/bin/{pg_config,postgres,pg_ctl}
+ cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl}
+ '';
+ };
postgresql = postgresqlAndPlugins pkgs.postgresql;
Modified: nixos/branches/stdenv-updates/modules/services/misc/disnix.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/misc/disnix.nix Fri Nov
26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/misc/disnix.nix Fri Nov
26 14:16:12 2010 (r24871)
@@ -6,7 +6,14 @@
let
cfg = config.services.disnix;
-
+
+ disnix_activation_scripts = pkgs.disnix_activation_scripts.override
(origArgs: {
+ enableApacheWebApplication = config.services.httpd.enable;
+ enableAxis2WebService = config.services.tomcat.axis2.enable;
+ enableEjabberdDump = config.services.ejabberd.enable;
+ enableMySQLDatabase = config.services.mysql.enable;
+ enableTomcatWebApplication = config.services.tomcat.enable;
+ });
in
{
@@ -20,7 +27,17 @@
enable = mkOption {
default = false;
description = "Whether to enable Disnix";
- };
+ };
+
+ useWebServiceInterface = mkOption {
+ default = false;
+ description = "Whether to enable the DisnixWebService interface running
on Apache Tomcat";
+ };
+
+ publishAvahi = mkOption {
+ default = false;
+ description = "Whether to publish capabilities/properties as a Disnix
service through Avahi";
+ };
};
@@ -31,11 +48,19 @@
config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.disnix ];
+ environment.systemPackages = [ pkgs.disnix ] ++ optional
cfg.useWebServiceInterface pkgs.DisnixWebService;
services.dbus.enable = true;
services.dbus.packages = [ pkgs.disnix ];
+ services.tomcat.enable = cfg.useWebServiceInterface;
+ services.tomcat.extraGroups = [ "disnix" ];
+ services.tomcat.javaOpts = "${optionalString cfg.useWebServiceInterface
"-Djava.library.path=${pkgs.libmatthew_java}/lib/jni"} ";
+ services.tomcat.sharedLibs = []
+ ++ optional cfg.useWebServiceInterface
"${pkgs.DisnixWebService}/share/java/DisnixConnection.jar"
+ ++ optional cfg.useWebServiceInterface
"${pkgs.dbus_java}/share/java/dbus.jar";
+ services.tomcat.webapps = [] ++ optional cfg.useWebServiceInterface
pkgs.DisnixWebService;
+
users.extraGroups = singleton
{ name = "disnix";
gid = config.ids.gids.disnix;
@@ -47,14 +72,37 @@
startOn = "started dbus";
script =
- ''
- export
PATH=/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
+ ''
+ export
PATH=/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
export HOME=/root
-
- ${pkgs.disnix}/bin/disnix-service
--activation-modules-dir=${pkgs.disnix_activation_scripts}/libexec/disnix/activation-scripts
+
+ ${pkgs.disnix}/bin/disnix-service
--activation-modules-dir=${disnix_activation_scripts}/libexec/disnix/activation-scripts
'';
};
+ } //
+ mkIf cfg.publishAvahi {
+
+ services.avahi.enable = true;
+
+ jobs.disnixAvahi =
+ { description = "Disnix Avahi publisher";
+
+ startOn = "started avahi-daemon";
+
+ exec =
+ ''
+ ${pkgs.avahi}/bin/avahi-publish-service
disnix-$(${pkgs.nettools}/bin/hostname) _disnix._tcp 22 \
+ "hostname=\"$(${pkgs.nettools}/bin/hostname)\"" \
+ "system=\"$(uname -m)-linux\"" \
+ "mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e
's/MemTotal://' -e 's/ //g')" \
+ ${optionalString (cfg.useWebServiceInterface)
''"targetEPR=\"http://(${pkgs.nettools}/bin/hostname):8080/DisnixWebService/services/DisnixWebService\""''}
\
+ ${optionalString (config.services.httpd.enable)
''"documentRoot=\"${config.services.httpd.documentRoot}\""''} \
+ ${optionalString (config.services.mysql.enable)
''"mysqlPort=3306"''} \
+ ${optionalString (config.services.tomcat.enable)
''"tomcatPort=8080"''} \
+ "supportedTypes=[$(for i in
${disnix_activation_scripts}/libexec/disnix/activation-scripts/*; do echo -n "
\"$(basename $i)\""; done) ]" \
+ ${concatMapStrings (deploymentAttrName: let deploymentAttrValue =
getAttr deploymentAttrName (config.deployment); in
''${deploymentAttrName}=\"${deploymentAttrValue}\" '' ) (attrNames
(config.deployment))}
+ '';
+ };
};
-
}
Modified: nixos/branches/stdenv-updates/modules/services/monitoring/monit.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/monitoring/monit.nix Fri Nov
26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/monitoring/monit.nix Fri Nov
26 14:16:12 2010 (r24871)
@@ -20,7 +20,7 @@
description = "monit.conf content";
};
startOn = mkOption {
- default = "network-interfaces/started";
+ default = "started network-interfaces";
description = "What Monit supposes to be already present";
};
};
Modified:
nixos/branches/stdenv-updates/modules/services/network-filesystems/nfs-kernel.nix
==============================================================================
---
nixos/branches/stdenv-updates/modules/services/network-filesystems/nfs-kernel.nix
Fri Nov 26 14:12:10 2010 (r24870)
+++
nixos/branches/stdenv-updates/modules/services/network-filesystems/nfs-kernel.nix
Fri Nov 26 14:16:12 2010 (r24871)
@@ -133,7 +133,15 @@
startOn = "started nfs-kernel-exports and started
nfs-kernel-mountd and started nfs-kernel-statd and started portmap";
stopOn = "stopping nfs-kernel-exports";
- preStart = "${pkgs.nfsUtils}/sbin/rpc.nfsd ${if
cfg.server.hostName != null then "-H ${cfg.server.hostName}" else ""}
${builtins.toString cfg.server.nproc}";
+ preStart =
+ ''
+ # Create a state directory required by NFSv4.
+ mkdir -p /var/lib/nfs/v4recovery
+
+ ${pkgs.nfsUtils}/sbin/rpc.nfsd \
+ ${if cfg.server.hostName != null then "-H
${cfg.server.hostName}" else ""} \
+ ${builtins.toString cfg.server.nproc}
+ '';
postStop = "${pkgs.nfsUtils}/sbin/rpc.nfsd 0";
};
Modified: nixos/branches/stdenv-updates/modules/services/networking/dhclient.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/networking/dhclient.nix
Fri Nov 26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/networking/dhclient.nix
Fri Nov 26 14:16:12 2010 (r24871)
@@ -8,7 +8,7 @@
# Don't start dhclient on explicitly configured interfaces.
ignoredInterfaces =
- map (i: i.name) (lib.filter (i: i ? ipAddress)
config.networking.interfaces);
+ map (i: i.name) (lib.filter (i: i ? ipAddress && i.ipAddress != "" )
config.networking.interfaces);
stateDir = "/var/lib/dhcp"; # Don't use /var/state/dhcp; not FHS-compliant.
Modified: nixos/branches/stdenv-updates/modules/services/web-servers/tomcat.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/web-servers/tomcat.nix
Fri Nov 26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/web-servers/tomcat.nix
Fri Nov 26 14:16:12 2010 (r24871)
@@ -26,6 +26,12 @@
description = "Location where Tomcat stores configuration files,
webapplications and logfiles";
};
+ extraGroups = mkOption {
+ default = [];
+ example = [ "users" ];
+ description = "Defines extra groups to which the tomcat user belongs.";
+ };
+
user = mkOption {
default = "tomcat";
description = "User account under which Apache Tomcat runs.";
@@ -104,6 +110,7 @@
uid = config.ids.uids.tomcat;
description = "Tomcat user";
home = "/homeless-shelter";
+ extraGroups = cfg.extraGroups;
};
jobs.tomcat =
Modified:
nixos/branches/stdenv-updates/modules/services/x11/display-managers/kdm.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/services/x11/display-managers/kdm.nix
Fri Nov 26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/services/x11/display-managers/kdm.nix
Fri Nov 26 14:16:12 2010 (r24871)
@@ -106,6 +106,13 @@
security.pam.services = [ { name = "kde"; } ];
+ users.extraUsers = singleton
+ { name = "kdm";
+ uid = config.ids.uids.kdm;
+ description = "kdm user";
+ home = "/tmp/kdm";
+ };
+
};
}
Modified: nixos/branches/stdenv-updates/modules/tasks/network-interfaces.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/tasks/network-interfaces.nix Fri Nov
26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/tasks/network-interfaces.nix Fri Nov
26 14:16:12 2010 (r24871)
@@ -8,6 +8,8 @@
cfg = config.networking;
+ ifconfig = "${nettools}/sbin/ifconfig";
+
in
{
@@ -113,6 +115,15 @@
'';
};
+ macAddress = mkOption {
+ default = "";
+ example = "00:11:22:33:44:55";
+ type = types.string;
+ description = ''
+ MAC address of the interface. Leave empty to use the default.
+ '';
+ };
+
};
};
@@ -155,9 +166,19 @@
export PATH=${config.system.sbin.modprobe}/sbin:$PATH
modprobe af_packet || true
+ ${pkgs.lib.concatMapStrings (i:
+ if i.macAddress != "" then
+ ''
+ echo "Configuring interface ${i.name}..."
+ ${ifconfig} "${i.name}" down || true
+ ${ifconfig} "${i.name}" hw ether "${i.macAddress}" || true
+ ''
+ else "") cfg.interfaces
+ }
+
for i in $(cd /sys/class/net && ls -d *); do
echo "Bringing up network device $i..."
- ${nettools}/sbin/ifconfig $i up || true
+ ${ifconfig} $i up || true
done
# Configure the manually specified interfaces.
@@ -169,7 +190,7 @@
if test -n "${i.subnetMask}"; then
extraFlags="$extraFlags netmask ${i.subnetMask}"
fi
- ${nettools}/sbin/ifconfig "${i.name}" "${i.ipAddress}"
$extraFlags || true
+ ${ifconfig} "${i.name}" "${i.ipAddress}" $extraFlags || true
''
else "") cfg.interfaces}
@@ -202,7 +223,7 @@
''
#for i in $(cd /sys/class/net && ls -d *); do
# echo "Taking down network device $i..."
- # ${nettools}/sbin/ifconfig $i down || true
+ # ${ifconfig} $i down || true
#done
'';
};
Modified: nixos/branches/stdenv-updates/modules/tasks/tty-backgrounds.nix
==============================================================================
--- nixos/branches/stdenv-updates/modules/tasks/tty-backgrounds.nix Fri Nov
26 14:12:10 2010 (r24870)
+++ nixos/branches/stdenv-updates/modules/tasks/tty-backgrounds.nix Fri Nov
26 14:16:12 2010 (r24871)
@@ -86,7 +86,8 @@
assertions = singleton
{ assertion = kernelPackages.splashutils != null;
- message = "kernelPackages.splashutils may not be false";
+ message = "The kernelPackages does not provide splashutils, as
required by ttyBackgrounds. " +
+ "Either provide kernelPackages with splashutils, or disable
ttyBackgrounds.";
};
services.ttyBackgrounds.specificThemes = singleton
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits