From debbb8a1997d1fa0a271923d96e44eda8906728f Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 24 May 2009 20:30:02 +0000 Subject: [PATCH 1/8] Made example of configurable DVD working with aby common base dir for NixOS/NixPkgs/Nix/configurations checkout svn path=/nixos/trunk/; revision=15705 --- installer/cd-dvd/rescue-dvd.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer/cd-dvd/rescue-dvd.nix b/installer/cd-dvd/rescue-dvd.nix index 8d0b62ce447a..c877ffa929bb 100644 --- a/installer/cd-dvd/rescue-dvd.nix +++ b/installer/cd-dvd/rescue-dvd.nix @@ -1,7 +1,7 @@ let - rescueCDFun = import /etc/nixos/nixos/installer/cd-dvd/rescue-cd.nix; - pkgs = import /etc/nixos/nixpkgs {}; - kernels = import /etc/nixos/configurations/misc/raskin/kernel-options.nix {inherit pkgs;}; + rescueCDFun = import ./rescue-cd.nix; + pkgs = import ../../../nixpkgs {}; + kernels = import ../../../configurations/misc/raskin/kernel-options.nix {inherit pkgs;}; bootEntries = baseKernel: rec { kernelPackages = let shippedKernelPackages = pkgs.kernelPackagesFor (baseKernel); @@ -74,7 +74,7 @@ rescueCDFun { pkgs.tcl ]; - nix = pkgs.nixCustomFun ("" + /etc/nixos/nix + "/") + nix = pkgs.nixCustomFun ("" + ../../../nix + "/") "" ["nix-reduce-build" "nix-http-export.cgi"] ["--with-docbook-xsl=${pkgs.docbook5_xsl}/xml/xsl/docbook/"]; From 48e7f85acb783b7939aa3b97e216a3b5ba25cf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 28 May 2009 22:02:47 +0000 Subject: [PATCH 2/8] Allowing the system bashrc not to be parsed, if an env variable exists. I think bash used not to include the system bashrc on "--rcfile myrc", but as now it doesn't allow it anymore, let's go on the env variable. svn path=/nixos/trunk/; revision=15779 --- etc/bashrc.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/bashrc.sh b/etc/bashrc.sh index 38f839f44769..71e2ff001db5 100644 --- a/etc/bashrc.sh +++ b/etc/bashrc.sh @@ -1,3 +1,6 @@ +if [ -n "$NOSYSBASHRC" ]; then + return +fi # Initialise a bunch of environment variables. export PATH=/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin export LD_LIBRARY_PATH=/var/run/opengl-driver/lib From 365df3e29a4c855068f598083c8aeec03aeb9fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 31 May 2009 18:51:29 +0000 Subject: [PATCH 3/8] Add `gpsd' Upstart job. svn path=/nixos/trunk/; revision=15811 --- system/ids.nix | 2 + system/options.nix | 1 + upstart-jobs/gpsd.nix | 108 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 upstart-jobs/gpsd.nix diff --git a/system/ids.nix b/system/ids.nix index a950ec84db12..240b2c8376bc 100644 --- a/system/ids.nix +++ b/system/ids.nix @@ -20,6 +20,7 @@ tomcat = 16; gnunetd = 17; pulseaudio = 22; # must match `pulseaudio' GID + gpsd = 23; nixbld = 30000; # start of range of uids nobody = 65534; @@ -47,6 +48,7 @@ lp = 20; tomcat = 21; pulseaudio = 22; # must match `pulseaudio' UID + gpsd = 23; users = 100; nixbld = 30000; diff --git a/system/options.nix b/system/options.nix index 9fa68009fa5a..95e9c421e8a6 100644 --- a/system/options.nix +++ b/system/options.nix @@ -3137,6 +3137,7 @@ root ALL=(ALL) SETENV: ALL ../upstart-jobs/cron/locate.nix ../upstart-jobs/manual.nix ../upstart-jobs/rogue.nix + ../upstart-jobs/gpsd.nix ../upstart-jobs/guest-users.nix ../upstart-jobs/pulseaudio.nix ../upstart-jobs/portmap.nix diff --git a/upstart-jobs/gpsd.nix b/upstart-jobs/gpsd.nix new file mode 100644 index 000000000000..6fa131fae908 --- /dev/null +++ b/upstart-jobs/gpsd.nix @@ -0,0 +1,108 @@ +{pkgs, config, ...}: + +###### interface +let + inherit (pkgs.lib) mkOption mkIf; + + uid = (import ../system/ids.nix).uids.gpsd; + gid = (import ../system/ids.nix).gids.gpsd; + + options = { + services = { + gpsd = { + + enable = mkOption { + default = false; + description = '' + Whether to enable `gpsd', a GPS service daemon. + ''; + }; + + device = mkOption { + default = "/dev/ttyUSB0"; + description = '' + A device may be a local serial device for GPS input, or a URL of the form: + [{dgpsip|ntrip}://][user:passwd@]host[:port][/stream] + in which case it specifies an input source for DGPS or ntrip data. + ''; + }; + + readonly = mkOption { + default = true; + description = '' + Whether to enable the broken-device-safety, otherwise + known as read-only mode. Some popular bluetooth and USB + receivers lock up or become totally inaccessible when + probed or reconfigured. This switch prevents gpsd from + writing to a receiver. This means that gpsd cannot + configure the receiver for optimal performance, but it + also means that gpsd cannot break the receiver. A better + solution would be for Bluetooth to not be so fragile. A + platform independent method to identify + serial-over-Bluetooth devices would also be nice. + ''; + }; + + port = mkOption { + default = 2947; + description = '' + The port where to listen for TCP connections. + ''; + }; + + debugLevel = mkOption { + default = 0; + description = '' + The debugging level. + ''; + }; + + }; + }; + }; + +in + +###### implementation +mkIf config.services.gpsd.enable { + require = [ + options + ]; + + users = { + extraUsers = [ + { name = "gpsd"; + inherit uid; + description = "gpsd daemon user"; + home = "/var/empty"; + } + ]; + + extraGroups = [ + { name = "gpsd"; + inherit gid; + } + ]; + }; + + services = + let cfg = config.services.gpsd; in { + extraJobs = [{ + name = "gpsd"; + + job = + let gpsd = pkgs.gpsd; + in '' + description "GPSD daemon" + + start on network-interfaces/started + stop on network-interfaces/stop + + respawn ${gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \ + -S "${toString cfg.port}" \ + ${if cfg.readonly then "-b" else ""} \ + "${cfg.device}" + ''; + }]; + }; +} From 5ed2a75f501f1c6d951707eb5a86506f3749712e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Jun 2009 14:31:21 +0000 Subject: [PATCH 4/8] * Don't include the services tree. It shouldn't be needed except for some legacy stuff. (And it broke the ISO build for the last month or so.) svn path=/nixos/trunk/; revision=15822 --- installer/cd-dvd/rescue-cd.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/installer/cd-dvd/rescue-cd.nix b/installer/cd-dvd/rescue-cd.nix index ef47d960613e..94c0d14e397c 100644 --- a/installer/cd-dvd/rescue-cd.nix +++ b/installer/cd-dvd/rescue-cd.nix @@ -5,7 +5,6 @@ else "nixos-${builtins.readFile ../../VERSION}" , compressImage ? false , nixpkgs ? ../../../nixpkgs -, services ? ../../../services # This option allows easy building of Rescue CD with # modified package set / driver set / anything. # For easier maitenance, let overrider know the current @@ -129,8 +128,6 @@ rec { tar xjf /install/nixos.tar.bz2 -C /etc/nixos/nixos mkdir -p /etc/nixos/nixpkgs tar xjf /install/nixpkgs.tar.bz2 -C /etc/nixos/nixpkgs - mkdir -p /etc/nixos/services - tar xjf /install/services.tar.bz2 -C /etc/nixos/services chown -R root.root /etc/nixos end script "; @@ -206,10 +203,6 @@ rec { nixosTarball = makeTarball "nixos.tar.bz2" ../..; - # Put Services in a tarball. - servicesTarball = makeTarball "services.tar.bz2" services; - - # Put Nixpkgs in a tarball. nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" nixpkgs; @@ -276,9 +269,6 @@ rec { { source = nixpkgsTarball + "/nixpkgs.tar.bz2"; target = "/install/nixpkgs.tar.bz2"; } - { source = servicesTarball + "/services.tar.bz2"; - target = "/install/services.tar.bz2"; - } ]; # Closures to be copied to the Nix store on the CD. From a0e7572da745580edf3e194ae2bcb4bfc1a5fd1c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Jun 2009 14:36:57 +0000 Subject: [PATCH 5/8] * Only set kdePackages if the X server is enabled. Otherwise we get KDE 3 in the ISO image. svn path=/nixos/trunk/; revision=15823 --- system/system.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/system.nix b/system/system.nix index d336eb813054..4d77a6a12607 100644 --- a/system/system.nix +++ b/system/system.nix @@ -274,15 +274,15 @@ rec { # The list of packages that need to appear in KDEDIRS, # XDG_CONFIG_DIRS and XDG_DATA_DIRS. # !!! This should be defined somewhere else. - kdePackages = - pkgs.lib.optionals (config.services.xserver.sessionType == "kde4") + kdePackages = + pkgs.lib.optionals (config.services.xserver.enable && config.services.xserver.sessionType == "kde4") [ pkgs.kde42.kdelibs pkgs.kde42.kdebase pkgs.kde42.kdebase_runtime pkgs.kde42.kdebase_workspace pkgs.shared_mime_info ] - ++ pkgs.lib.optionals (config.services.xserver.sessionType == "kde") + ++ pkgs.lib.optionals (config.services.xserver.enable && config.services.xserver.sessionType == "kde") [ pkgs.kdebase pkgs.kdelibs ] From 40497a10e651f74b7530e1813ceab8f0e9901aa1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Jun 2009 14:53:24 +0000 Subject: [PATCH 6/8] * The manual/rogue jobs already declare an extry TTY. svn path=/nixos/trunk/; revision=15824 --- installer/cd-dvd/rescue-cd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/cd-dvd/rescue-cd.nix b/installer/cd-dvd/rescue-cd.nix index 94c0d14e397c..85fc97482e6e 100644 --- a/installer/cd-dvd/rescue-cd.nix +++ b/installer/cd-dvd/rescue-cd.nix @@ -25,7 +25,7 @@ rec { boot = { isLiveCD = true; - extraTTYs = [7 8]; # manual, rogue + extraModulePackages = [system.kernelPackages.aufs]; kernelPackages = pkgs.kernelPackages_2_6_28; From b425888b621f0d8d458f59af0e7fe9447652cbb7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Jun 2009 21:16:06 +0000 Subject: [PATCH 7/8] * Updated URL. svn path=/nixos/trunk/; revision=15831 --- installer/cd-dvd/rescue-cd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/cd-dvd/rescue-cd.nix b/installer/cd-dvd/rescue-cd.nix index 85fc97482e6e..766a4332f934 100644 --- a/installer/cd-dvd/rescue-cd.nix +++ b/installer/cd-dvd/rescue-cd.nix @@ -149,7 +149,7 @@ rec { }; installer = { - nixpkgsURL = http://nixos.org/releases/nixpkgs/unstable; + nixpkgsURL = http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable; }; security = { From d5fbea2dbb8f861517c1380abd6421849efec6ed Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 9 Jun 2009 07:46:41 +0000 Subject: [PATCH 8/8] svn path=/nixos/trunk/; revision=15899 --- installer/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/installer/default.nix b/installer/default.nix index dfa2ab38eeba..02c1c514e6ce 100644 --- a/installer/default.nix +++ b/installer/default.nix @@ -21,12 +21,10 @@ in name = "nixos-install"; src = ./nixos-install.sh; - inherit (pkgs) perl; + inherit (pkgs) perl pathsFromGraph; inherit nix; nixpkgsURL = config.installer.nixpkgsURL; - pathsFromGraph = "${pkgs.path}/build-support/kernel/paths-from-graph.pl"; - nixClosure = pkgs.runCommand "closure" {exportReferencesGraph = ["refs" nix];} "cp refs $out";