From 2ec60d4023dce9edfe6e93d7f742c54bcdf65448 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:04 +0000 Subject: [PATCH 01/16] * Add support for the Cirrus driver. This is useful in QEMU/KVM because it emulates a Cirrus card. Author: eelco @ rev 14227 svn path=/nixos/branches/fix-style/; revision=14439 --- upstart-jobs/xserver/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/upstart-jobs/xserver/default.nix b/upstart-jobs/xserver/default.nix index 501597c12f2..5e0e227887d 100644 --- a/upstart-jobs/xserver/default.nix +++ b/upstart-jobs/xserver/default.nix @@ -298,6 +298,7 @@ let nv = { modules = [xorg.xf86videonv]; }; ati = { modules = [xorg.xf86videoati]; }; via = { modules = [xorg.xf86videovia]; }; + cirrus = { modules = [xorg.xf86videocirrus]; }; }; # Get a bunch of user settings. From c69348cd0737af745c79f1974897b8e2b3d182d9 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:12 +0000 Subject: [PATCH 02/16] Automated install is once more succesful Author: raskin @ rev 14229 svn path=/nixos/branches/fix-style/; revision=14440 --- installer/cd-dvd/remote-install-scripts/install-script.sh | 2 +- installer/cd-dvd/remote-install-scripts/install-test.sh | 2 +- installer/cd-dvd/rescue-cd-configurable.nix | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/installer/cd-dvd/remote-install-scripts/install-script.sh b/installer/cd-dvd/remote-install-scripts/install-script.sh index fbacf6ff6a5..574cdb40a22 100755 --- a/installer/cd-dvd/remote-install-scripts/install-script.sh +++ b/installer/cd-dvd/remote-install-scripts/install-script.sh @@ -14,7 +14,7 @@ mkdir -p /mnt/etc/nixos cat > /mnt/etc/nixos/configuration.nix < report nix-build -o socat /etc/nixos/nixpkgs -A socat || { echo "Failed to build socat" >&2 ; exit 2; }; -nix-build -o qemu /etc/nixos/nixpkgs -A qemu || { echo "Failed to build qemu" >&2 ; exit 2; }; +nix-build -o qemu /etc/nixos/nixpkgs -A ${QEMU_PACKAGE:-qemu} || { echo "Failed to build qemu" >&2 ; exit 2; }; echo "reboot" | ./socat/bin/socat tcp-listen:4424 stdio >> report & diff --git a/installer/cd-dvd/rescue-cd-configurable.nix b/installer/cd-dvd/rescue-cd-configurable.nix index e727d2d1f2d..f021c19b63b 100644 --- a/installer/cd-dvd/rescue-cd-configurable.nix +++ b/installer/cd-dvd/rescue-cd-configurable.nix @@ -137,7 +137,7 @@ rec { nixpkgsRel = "nixpkgs" + (if networkNixpkgs != "" then "-" + networkNixpkgs else ""); - configuration = pkgs: final_configuration: let preConfiguration ={ + configuration = {pkgs, config, ...}: let preConfiguration ={ boot = { isLiveCD = true; # The label used to identify the installation CD. @@ -164,8 +164,8 @@ rec { udev = { addFirmware = [] - ++ (pkgs.lib.optional intel3945FWEnable pkgs.iwlwifi3945ucode) - ++ (pkgs.lib.optional intel4965FWEnable pkgs.iwlwifi4965ucode) + #++ (pkgs.lib.optional intel3945FWEnable pkgs.iwlwifi3945ucode) + #++ (pkgs.lib.optional intel4965FWEnable pkgs.iwlwifi4965ucode) ; }; From 119fff4c4c5f1777c63a2deb739aa45bd0c51548 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:17 +0000 Subject: [PATCH 03/16] portmap: Add options. Author: ludo @ rev 14233 svn path=/nixos/branches/fix-style/; revision=14441 --- upstart-jobs/portmap.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/portmap.nix b/upstart-jobs/portmap.nix index 0c3368545c2..d0978952820 100644 --- a/upstart-jobs/portmap.nix +++ b/upstart-jobs/portmap.nix @@ -15,6 +15,21 @@ let using the rpcinfo(1) command. ''; }; + + verbose = mkOption { + default = false; + description = '' + Whether to enable verbose output. + ''; + }; + + chroot = mkOption { + default = "/var/empty"; + description = '' + If non-empty, a path to change root to. + ''; + }; + }; }; }; @@ -63,8 +78,12 @@ mkIf config.services.portmap.enable { start on network-interfaces/started stop on network-interfaces/stop - respawn ${portmap}/sbin/portmap - ''; + respawn ${portmap}/sbin/portmap \ + ${if config.services.portmap.chroot == "" + then "" + else "-t \"${config.services.portmap.chroot}\""} \ + ${if config.services.portmap.verbose then "-v" else ""} + ''; }]; }; } From 221680936e8ea9687b60c7687c624cecbda11c55 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:22 +0000 Subject: [PATCH 04/16] Updating LiveDVD with X expressions Author: raskin @ rev 14251 svn path=/nixos/branches/fix-style/; revision=14442 --- installer/cd-dvd/live-dvd-X-medium.nix | 26 ++++++++++----------- installer/cd-dvd/live-dvd-X-no-soft.nix | 25 ++++++++++----------- installer/cd-dvd/live-dvd-X.nix | 30 ++++++++++++------------- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/installer/cd-dvd/live-dvd-X-medium.nix b/installer/cd-dvd/live-dvd-X-medium.nix index ec0089ded56..db57921b4c5 100644 --- a/installer/cd-dvd/live-dvd-X-medium.nix +++ b/installer/cd-dvd/live-dvd-X-medium.nix @@ -22,7 +22,7 @@ let in (isoFun (rec { inherit platform; - lib = (import ../pkgs/lib); + lib = (import ../../pkgs/lib); networkNixpkgs = ""; manualEnabled = true; @@ -171,40 +171,40 @@ in configList = configuration : [ { suffix = "X-vesa"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with vesa";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with vesa";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "vesa";}; }; }); } { suffix = "X-Intel"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with Intel graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with Intel graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;}; }; }); } { suffix = "X-ATI"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with ATI graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with ATI graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;}; }; }); } { suffix = "X-NVIDIA"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with NVIDIA graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with NVIDIA graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "nvidia"; driSupport = true;}; }; }); diff --git a/installer/cd-dvd/live-dvd-X-no-soft.nix b/installer/cd-dvd/live-dvd-X-no-soft.nix index 7111107b675..62ebf683d09 100644 --- a/installer/cd-dvd/live-dvd-X-no-soft.nix +++ b/installer/cd-dvd/live-dvd-X-no-soft.nix @@ -18,7 +18,6 @@ let windowManager = "twm"; tty = "9"; }; - pkgs in (isoFun { @@ -80,40 +79,40 @@ in configList = configuration : [ { suffix = "X-vesa"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with vesa";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with vesa";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "vesa";}; }; }); } { suffix = "X-Intel"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with Intel graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with Intel graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;}; }; }); } { suffix = "X-ATI"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with ATI graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with ATI graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;}; }; }); } { suffix = "X-NVIDIA"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with NVIDIA graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with NVIDIA graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "nvidia"; driSupport = true;}; }; }); diff --git a/installer/cd-dvd/live-dvd-X.nix b/installer/cd-dvd/live-dvd-X.nix index e9b3c2df2eb..c98b398a9af 100644 --- a/installer/cd-dvd/live-dvd-X.nix +++ b/installer/cd-dvd/live-dvd-X.nix @@ -20,9 +20,9 @@ let }; in -(isoFun { +(isoFun (rec { inherit platform; - lib = (import ../pkgs/lib); + lib = (import ../../pkgs/lib); networkNixpkgs = ""; manualEnabled = true; @@ -182,43 +182,43 @@ in configList = configuration : [ { suffix = "X-vesa"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with vesa";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with vesa";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "vesa";}; }; }); } { suffix = "X-Intel"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with Intel graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with Intel graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;}; }; }); } { suffix = "X-ATI"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with ATI graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with ATI graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;}; }; }); } { suffix = "X-NVIDIA"; - configuration = (configuration // + configuration = args: ((configuration args) // { - boot=configuration.boot // {configurationName = "X with NVIDIA graphic card";}; - services = configuration.services // { + boot=(configuration args).boot // {configurationName = "X with NVIDIA graphic card";}; + services = (configuration args).services // { xserver = xConfiguration // {videoDriver = "nvidia"; driSupport = true;}; }; }); } ]; -}).rescueCD +})).rescueCD From 08f32ca62a14a9da87a0a085860b436c70e071ea Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:26 +0000 Subject: [PATCH 05/16] * Make nix-channel and nix-env work when chroots are enabled. Author: eelco @ rev 14271 svn path=/nixos/branches/fix-style/; revision=14443 --- upstart-jobs/nix.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/upstart-jobs/nix.nix b/upstart-jobs/nix.nix index c46b721a2a0..61ddbfbe80f 100644 --- a/upstart-jobs/nix.nix +++ b/upstart-jobs/nix.nix @@ -190,16 +190,22 @@ in # other paths in the store, we need the closure of /bin/sh # in `build-chroot-dirs' - otherwise any builder that uses # /bin/sh won't work. - refs = pkgs.writeReferencesToFile binsh; + binshDeps = pkgs.writeReferencesToFile binsh; + + # Likewise, if chroots are turned on, we need Nix's own + # closure in the chroot. Otherwise nix-channel and nix-env + # won't work because the dependencies of its builders (like + # coreutils and Perl) aren't visible. Sigh. + nixDeps = pkgs.writeReferencesToFile config.environment.nix; in pkgs.runCommand "nix.conf" {} '' - binshDeps=$(for i in $(cat ${refs}); do if test -d $i; then echo $i; fi; done) + extraPaths=$(for i in $(cat ${binshDeps} ${nixDeps}); do if test -d $i; then echo $i; fi; done) cat > $out < Date: Sat, 7 Mar 2009 18:01:33 +0000 Subject: [PATCH 06/16] * Need gzip in the Nix daemon's PATH. Forgot to commit this. Author: eelco @ rev 14274 svn path=/nixos/branches/fix-style/; revision=14444 --- upstart-jobs/nix-daemon.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/nix-daemon.nix b/upstart-jobs/nix-daemon.nix index 553c1c93533..939539a42f9 100644 --- a/upstart-jobs/nix-daemon.nix +++ b/upstart-jobs/nix-daemon.nix @@ -8,9 +8,9 @@ stop on shutdown respawn script - export PATH=${if config.nix.distributedBuilds then "${pkgs.openssh}/bin:" else ""}${pkgs.openssl}/bin:${nix}/bin:$PATH + export PATH=${if config.nix.distributedBuilds then "${pkgs.openssh}/bin:${pkgs.gzip}/bin:" else ""}${pkgs.openssl}/bin:${nix}/bin:$PATH ${nixEnvVars} - exec ${nix}/bin/nix-worker --daemon > /dev/null 2>&1 + exec nice -10 ${nix}/bin/nix-worker --daemon > /dev/null 2>&1 end script "; From 02ed3f12ed65b73ec7b738d85ecb6a11e12a9440 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:38 +0000 Subject: [PATCH 07/16] * Support special characters in config.nix.extraOptions. Author: eelco @ rev 14278 svn path=/nixos/branches/fix-style/; revision=14445 --- upstart-jobs/nix.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/nix.nix b/upstart-jobs/nix.nix index 61ddbfbe80f..8b43036485e 100644 --- a/upstart-jobs/nix.nix +++ b/upstart-jobs/nix.nix @@ -198,7 +198,7 @@ in # coreutils and Perl) aren't visible. Sigh. nixDeps = pkgs.writeReferencesToFile config.environment.nix; in - pkgs.runCommand "nix.conf" {} '' + pkgs.runCommand "nix.conf" {extraOptions = config.nix.extraOptions; } '' extraPaths=$(for i in $(cat ${binshDeps} ${nixDeps}); do if test -d $i; then echo $i; fi; done) cat > $out < Date: Sat, 7 Mar 2009 18:01:42 +0000 Subject: [PATCH 08/16] Fixing vsftpd without anonymous users, adding localUsers, and creating chroot path. Author: viric @ rev 14286 svn path=/nixos/branches/fix-style/; revision=14446 --- upstart-jobs/vsftpd.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/upstart-jobs/vsftpd.nix b/upstart-jobs/vsftpd.nix index 22d11eab51b..1cbd2ac092b 100644 --- a/upstart-jobs/vsftpd.nix +++ b/upstart-jobs/vsftpd.nix @@ -20,6 +20,13 @@ let Whether to enable the anonymous FTP user. "; }; + + localUsers = mkOption { + default = false; + description = " + Whether to enable FTP for the local users. + "; + }; writeEnable = mkOption { default = false; @@ -50,7 +57,7 @@ in let - inherit (config.services.vsftpd) anonymousUser writeEnable anonymousUploadEnable anonymousMkdirEnable; + inherit (config.services.vsftpd) anonymousUser localUsers writeEnable anonymousUploadEnable anonymousMkdirEnable; inherit (pkgs) vsftpd; yesNoOption = p : name : @@ -99,6 +106,7 @@ mkIf config.services.vsftpd.enable { start script cat > /etc/vsftpd.conf < Date: Sat, 7 Mar 2009 18:01:47 +0000 Subject: [PATCH 09/16] Adding the ftp pam service, for vsftpd. Author: viric @ rev 14287 svn path=/nixos/branches/fix-style/; revision=14447 --- etc/default.nix | 1 + etc/pam.d/ftp | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 etc/pam.d/ftp diff --git a/etc/default.nix b/etc/default.nix index 8579b334e67..b396437c17c 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -191,6 +191,7 @@ let "chsh" "xlock" "cups" + "ftp" "common" "common-console" # shared stuff for interactive local sessions ] diff --git a/etc/pam.d/ftp b/etc/pam.d/ftp new file mode 100644 index 00000000000..50f3cc5ce60 --- /dev/null +++ b/etc/pam.d/ftp @@ -0,0 +1,4 @@ +auth include common +account include common +password include common +session include common From e05e4b6bcacf8a9642bf8d306babd3c082513eb2 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:51 +0000 Subject: [PATCH 10/16] Author: eelco @ rev 14411 svn path=/nixos/branches/fix-style/; revision=14448 --- doc/manual/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/default.nix b/doc/manual/default.nix index c46e89d0fa1..4f1e555583d 100644 --- a/doc/manual/default.nix +++ b/doc/manual/default.nix @@ -41,7 +41,7 @@ let ./manual.xml cp ${./style.css} $out/style.css ensureDir $out/nix-support - echo "doc manual $out" >> $out/nix-support/hydra-build-products + echo "doc manual $out manual.html" >> $out/nix-support/hydra-build-products ''; }; From 0a010e671a3663c2235a92a94cd47361a215f6ef Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 7 Mar 2009 18:01:55 +0000 Subject: [PATCH 11/16] * Include the version in the name attribute. Author: eelco @ rev 14413 svn path=/nixos/branches/fix-style/; revision=14449 --- release.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/release.nix b/release.nix index d291e21b8dd..24b70478748 100644 --- a/release.nix +++ b/release.nix @@ -14,11 +14,15 @@ let releaseTools.makeSourceTarball { name = "nixos-tarball"; + + version = builtins.readFile ./VERSION; + src = nixosSrc; + inherit officialRelease; distPhase = '' - releaseName=nixos-$(cat $src/VERSION)$VERSION_SUFFIX + releaseName=nixos-$VERSION ensureDir "$out/tarballs" mkdir ../$releaseName cp -prd . ../$releaseName @@ -50,16 +54,18 @@ let let + version = builtins.readFile ./VERSION + (if officialRelease then "" else "pre${toString nixosSrc.rev}"); + iso = (import "${nixosSrc.path}/installer/cd-dvd/rescue-cd.nix" { platform = system; compressImage = true; nixpkgsPath = nixpkgs.path; - relName = "nixos-${builtins.readFile ./VERSION}${if !officialRelease then "pre${toString nixosSrc.rev}" else ""}"; + relName = "nixos-${version}"; }).rescueCD; in # Declare the ISO as a build product so that it shows up in Hydra. - runCommand "nixos-iso" + runCommand "nixos-iso-${version}" { meta = { description = "NixOS installation CD ISO image for ${system}"; }; From aeba0af8dd6ced7a2da7e778a28e3d7d627cada1 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 9 Mar 2009 19:18:27 +0000 Subject: [PATCH 12/16] Allow specifying [] as filesystem option because you don't need any on vservers You still get a warning when not setting the value so that you can't forget it. svn path=/nixos/branches/fix-style/; revision=14477 --- boot/boot-stage-1.nix | 2 +- system/options.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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..68cad69d0d7 100644 --- a/system/options.nix +++ b/system/options.nix @@ -303,7 +303,7 @@ in fileSystems = mkOption { - default = []; + default = null; example = [ { mountPoint = "/"; device = "/dev/hda1"; From 313c440174c154fbf2258eea4caba7441ab6b685 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sun, 15 Mar 2009 20:05:36 +0000 Subject: [PATCH 13/16] Use the nix-daemon provided by the nix version install with NixOS. This remove a dependency on nix-0.12. svn path=/nixos/branches/fix-style/; revision=14543 --- upstart-jobs/nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From ab4e37d53fdf3cb573454caa29fbd19ba30175e2 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sun, 15 Mar 2009 20:18:36 +0000 Subject: [PATCH 14/16] Remove unused file. svn path=/nixos/branches/fix-style/; revision=14545 --- upstart-jobs/nix-daemon.nix | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 upstart-jobs/nix-daemon.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 - "; - -} From d7fcb32e9b4f5db97bd428aa30464f01e1a02b00 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 30 Mar 2009 14:58:05 +0000 Subject: [PATCH 15/16] readding synergy svn path=/nixos/branches/fix-style/; revision=14789 --- system/options.nix | 2 + upstart-jobs/synergy.nix | 129 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 upstart-jobs/synergy.nix diff --git a/system/options.nix b/system/options.nix index 68cad69d0d7..7e186b71551 100644 --- a/system/options.nix +++ b/system/options.nix @@ -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/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 +*/ From 2b6554b5194c93d5cff4d5165f879f201349b32a Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Wed, 1 Apr 2009 20:28:04 +0000 Subject: [PATCH 16/16] allow specifying custom udev rules in /etc/nixos/configuration.nix svn path=/nixos/branches/fix-style/; revision=14826 --- upstart-jobs/udev.nix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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;