* Synced with branches/fix-style @ 14826

svn path=/nixos/branches/modular-nixos/; revision=14952
This commit is contained in:
Nicolas Pierron 2009-04-08 13:53:29 +00:00
commit 840dc8c612
6 changed files with 153 additions and 22 deletions

View File

@ -148,7 +148,7 @@ rec {
# !!! copy&pasted from upstart-jobs/filesystems.nix.
mountPoints =
if fileSystems == []
if fileSystems == null
then abort "You must specify the fileSystems option!"
else map (fs: fs.mountPoint) fileSystems;
devices = map (fs: if fs ? device then fs.device else "/dev/disk/by-label/${fs.label}") fileSystems;

View File

@ -303,7 +303,7 @@ in
fileSystems = mkOption {
default = [];
default = null;
example = [
{ mountPoint = "/";
device = "/dev/hda1";
@ -480,6 +480,8 @@ in
(import ../upstart-jobs/mingetty.nix) # The terminals on ttyX.
(import ../upstart-jobs/tty-backgrounds.nix) #FIXME (assertion)
(import ../upstart-jobs/synergy.nix)
# nix
(import ../upstart-jobs/nix.nix) # nix options and daemon
(import ../system/nixos-installer.nix)

View File

@ -1,17 +0,0 @@
{config, pkgs, nix, nixEnvVars}:
{
name = "nix-daemon";
job = "
start on startup
stop on shutdown
respawn
script
export PATH=${if config.nix.distributedBuilds then "${pkgs.openssh}/bin:${pkgs.gzip}/bin:" else ""}${pkgs.openssl}/bin:${nix}/bin:$PATH
${nixEnvVars}
exec nice -10 ${nix}/bin/nix-worker --daemon > /dev/null 2>&1
end script
";
}

View File

@ -170,7 +170,7 @@ in
let
binsh = config.system.build.binsh;
nixEnvVars = config.nix.envVars;
inherit (pkgs) nix;
inherit (config.environment) nix;
in
{

129
upstart-jobs/synergy.nix Normal file
View File

@ -0,0 +1,129 @@
{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
options = {
services = {
synergy = {
client = {
enable = mkOption {
default = false;
description = "
Whether to enable the synergy client (receive keyboard and mouse events from a synergy server)
";
};
screenName = mkOption {
default = "";
description = "
use screen-name instead the hostname to identify
ourselfs to the server.
";
};
};
server = {
enable = mkOption {
default = false;
description = "
Whether to enable the synergy server (send keyboard and mouse events)
";
};
configFile = mkOption {
default = "/etc/synergy-server.conf";
description = "
The synergy server configuration file. open upstart-jobs/synergy.nix to see an example
";
};
screenName = mkOption {
default = "";
description = "
use screen-name instead the hostname to identify
this screen in the configuration.
";
};
address = mkOption {
default = "";
description = "listen for clients on the given address";
};
};
};
};
};
###### implementation
inherit (pkgs.lib) optional;
cfgC = (config.services.synergy.client);
cfgS = (config.services.synergy.server);
clientJob = {
name = "synergy-client";
job = ''
description "synergy client"
start on started network-interfaces
stop on stopping network-interfaces
respawn ${pkgs.synergy}/bin/synergyc ${if cfgS.screenName == "" then "" else "-n ${cfgS.screenName}" }
'';
};
serverJob = {
name = "synergy-server";
job = ''
description "synergy server"
start on started network-interfaces
stop on stopping network-interfaces
respawn ${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} \
-f ${if cfgS.address == "" then "" else "-a ${cfgS.address}"} \
${if cfgS.screenName == "" then "" else "-n ${cfgS.screenName}" }
'';
};
in
mkIf config.services.sshd.enable {
require = [
options
];
services = {
extraJobs = (optional cfgS.enable serverJob)
++ (optional cfgC.enable clientJob);
};
}
/* SYNERGY SERVER example configuration file
section: screens
laptop:
dm:
win:
end
section: aliases
laptop:
192.168.5.5
dm:
192.168.5.78
win:
192.168.5.54
end
section: links
laptop:
left = dm
dm:
right = laptop
left = win
win:
right = dm
end
*/

View File

@ -22,11 +22,22 @@ let
addUdevPkgs = mkOption {
default = [];
description = "
List of packages containing udev rules.
List of packages containing udev rules. All files found in $out/*/udev/rules.d/*.rules will be recognized
";
merge = pkgs.lib.mergeListOption;
};
extraRules = mkOption {
default = "";
example = ''
KERNEL=="eth*", ATTR{address}=="00:1D:60:B9:6D:4F", NAME="my_fast_network_card"
'';
description = "
Add custom rules. They'll be written into file 10-local.rules.
Thus they are read before all other rules.
";
};
sndMode = mkOption {
default = "0600";
example = "0666";
@ -58,7 +69,13 @@ let
};
firmwareDirs = config.services.udev.addFirmware;
extraUdevPkgs = config.services.udev.addUdevPkgs;
extraUdevPkgs = config.services.udev.addUdevPkgs
++ pkgs.lib.optional (cfg.extraRules != "")
(pkgs.writeTextFile {
name = "extra-udev-rules";
text = cfg.extraRules;
destination = "/custom/udev/rules.d/10-local.rules";
});
modprobe = config.system.sbin.modprobe;