summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-06-05 17:19:30 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-06-05 17:19:30 +0000
commiteb8b534173511e29c2ca58410b10863a434932a3 (patch)
treee326ee01c7eb239d4328037062bdfe9463016d22
parentdbe229f3aac983750c405b30c2b487bba765d747 (diff)
downloadnixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.tar
nixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.tar.gz
nixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.tar.bz2
nixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.tar.lz
nixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.tar.xz
nixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.tar.zst
nixpkgs-eb8b534173511e29c2ca58410b10863a434932a3.zip
* Include only the en_US locale on the CD. This saves 75 MiB or so.
svn path=/nixos/branches/modular-nixos/; revision=15883
-rw-r--r--modules/config/i18n.nix33
-rw-r--r--modules/config/system-path.nix1
-rw-r--r--modules/installer/cd-dvd/installation-cd.nix20
-rw-r--r--modules/programs/bash/bash.nix1
-rw-r--r--modules/programs/bash/bashrc.sh3
-rw-r--r--modules/programs/info.nix5
6 files changed, 55 insertions, 8 deletions
diff --git a/modules/config/i18n.nix b/modules/config/i18n.nix
index c7a6f1c24d8..744eaee6667 100644
--- a/modules/config/i18n.nix
+++ b/modules/config/i18n.nix
@@ -16,6 +16,18 @@ let
         ";
       };
 
+      supportedLocales = mkOption {
+        default = ["all"];
+        example = ["en_US.UTF-8/UTF-8" "nl_NL.UTF-8/UTF-8" "nl_NL/ISO-8859-1"];
+        description = ''
+          List of locales that the system should support.  The value
+          <literal>"all"</literal> means that all locales supported by
+          Glibc will be installed.  A full list of supported locales
+          can be found at <link
+          xlink:href="http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc"/>.
+        '';
+      };
+
       consoleFont = mkOption {
         default = "lat9w-16";
         example = "LatArCyrHeb-16";
@@ -39,8 +51,23 @@ in
 
 ###### implementation
 
+let
+
+  glibcLocales = pkgs.glibcLocales.override {
+    allLocales = pkgs.lib.any (x: x == "all") config.i18n.supportedLocales;
+    locales = config.i18n.supportedLocales;
+  };
+
+in
+
 {
-  require = [
-    options
-  ];
+  require = options;
+
+  environment.systemPackages = [glibcLocales];
+
+  environment.shellInit =
+    ''
+      export LANG=${config.i18n.defaultLocale}
+      export LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
+    '';
 }
diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix
index 62fbde95f7f..804b9419a45 100644
--- a/modules/config/system-path.nix
+++ b/modules/config/system-path.nix
@@ -21,7 +21,6 @@ let
       pkgs.e2fsprogs
       pkgs.findutils
       pkgs.glibc # for ldd, getent
-      pkgs.glibcLocales
       pkgs.gnugrep
       pkgs.gnused
       pkgs.gnutar
diff --git a/modules/installer/cd-dvd/installation-cd.nix b/modules/installer/cd-dvd/installation-cd.nix
index 24c01dcfe4b..e5181aebda6 100644
--- a/modules/installer/cd-dvd/installation-cd.nix
+++ b/modules/installer/cd-dvd/installation-cd.nix
@@ -18,6 +18,10 @@
   # Disable some other stuff we don't need.
   security.sudo.enable = false;
 
+  # Include only the en_US locale.  This saves 75 MiB or so compared to
+  # the full glibcLocales package.
+  i18n.supportedLocales = ["en_US.UTF-8/UTF-8" "en_US/ISO-8859-1"];
+
   # Include some utilities that are useful for installing or repairing
   # the system.
   environment.systemPackages =
@@ -77,4 +81,20 @@
   # nixos-install will do a pull from this channel to speed up the
   # installation.
   installer.nixpkgsURL = http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable;
+
+  # Provide the NixOS/Nixpkgs sources in /etc/nixos.  This is required
+  # for nixos-install.
+  boot.postBootCommands =
+    ''
+      export PATH=${pkgs.gnutar}/bin:${pkgs.bzip2}/bin:$PATH
+
+      mkdir -p /mnt
+
+      echo "unpacking the NixOS/Nixpkgs sources..."
+      mkdir -p /etc/nixos/nixos
+      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
+      chown -R root.root /etc/nixos
+    '';
 }
diff --git a/modules/programs/bash/bash.nix b/modules/programs/bash/bash.nix
index 205cadea7f3..f7ac48ccb28 100644
--- a/modules/programs/bash/bash.nix
+++ b/modules/programs/bash/bash.nix
@@ -33,7 +33,6 @@ in
           systemPath = config.system.path;
           wrapperDir = config.security.wrapperDir;
           modulesTree = config.system.modulesTree;
-          defaultLocale = config.i18n.defaultLocale;
           shellInit = config.environment.shellInit;
         };
         target = "bashrc";      
diff --git a/modules/programs/bash/bashrc.sh b/modules/programs/bash/bashrc.sh
index d18cb010b50..92ca71100ee 100644
--- a/modules/programs/bash/bashrc.sh
+++ b/modules/programs/bash/bashrc.sh
@@ -5,11 +5,8 @@ export MODULE_DIR=@modulesTree@/lib/modules
 export NIXPKGS_CONFIG=/nix/etc/config.nix
 export NIXPKGS_ALL=/etc/nixos/nixpkgs
 export PAGER="less -R"
-export LANG=@defaultLocale@
 export EDITOR=nano
-export INFOPATH=/var/run/current-system/sw/info:/var/run/current-system/sw/share/info
 export LOCATE_PATH=/var/cache/locatedb
-export LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
 @shellInit@
 
 
diff --git a/modules/programs/info.nix b/modules/programs/info.nix
index e3b8025f933..a12aef6a7d0 100644
--- a/modules/programs/info.nix
+++ b/modules/programs/info.nix
@@ -33,4 +33,9 @@ in
 
 {
   environment.systemPackages = [infoWrapper];
+  
+  environment.shellInit =
+    ''
+      export INFOPATH=/var/run/current-system/sw/info:/var/run/current-system/sw/share/info  
+    '';
 }