diff --git a/boot/boot-stage-1.nix b/boot/boot-stage-1.nix index 7b7f5503d0b..46d4a52c6c9 100644 --- a/boot/boot-stage-1.nix +++ b/boot/boot-stage-1.nix @@ -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; diff --git a/system/options.nix b/system/options.nix index 53a3d11d7f6..7e186b71551 100644 --- a/system/options.nix +++ b/system/options.nix @@ -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) diff --git a/upstart-jobs/nix-daemon.nix b/upstart-jobs/nix-daemon.nix deleted file mode 100644 index 939539a42f9..00000000000 --- a/upstart-jobs/nix-daemon.nix +++ /dev/null @@ -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 - "; - -} diff --git a/upstart-jobs/nix.nix b/upstart-jobs/nix.nix index 8b43036485e..ff25c5691ec 100644 --- a/upstart-jobs/nix.nix +++ b/upstart-jobs/nix.nix @@ -170,7 +170,7 @@ in let binsh = config.system.build.binsh; nixEnvVars = config.nix.envVars; - inherit (pkgs) nix; + inherit (config.environment) nix; in { diff --git a/upstart-jobs/synergy.nix b/upstart-jobs/synergy.nix new file mode 100644 index 00000000000..04b581002c2 --- /dev/null +++ b/upstart-jobs/synergy.nix @@ -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 +*/ diff --git a/upstart-jobs/udev.nix b/upstart-jobs/udev.nix index 4765f29176e..30fc4279171 100644 --- a/upstart-jobs/udev.nix +++ b/upstart-jobs/udev.nix @@ -22,10 +22,21 @@ 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"; @@ -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;