about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-06-10 13:03:44 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-06-10 13:03:44 +0200
commit491c088731022463978e595956427e72db6306a9 (patch)
tree7b72dcd17ad081d12fbf24d39b0cd4c12a0651f2 /nixos/modules
parent9265a61453f0df3a8bbaf3dc53e32c239e3bdcf9 (diff)
downloadnixlib-491c088731022463978e595956427e72db6306a9.tar
nixlib-491c088731022463978e595956427e72db6306a9.tar.gz
nixlib-491c088731022463978e595956427e72db6306a9.tar.bz2
nixlib-491c088731022463978e595956427e72db6306a9.tar.lz
nixlib-491c088731022463978e595956427e72db6306a9.tar.xz
nixlib-491c088731022463978e595956427e72db6306a9.tar.zst
nixlib-491c088731022463978e595956427e72db6306a9.zip
Revert "Merge #2692: Use pam_env to properly setup system-wide env"
This reverts commit 18a0cdd86416a8cbc263cfa8cb96c460a53f7b5c.
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/config/i18n.nix2
-rw-r--r--nixos/modules/config/shells-environment.nix1
-rw-r--r--nixos/modules/config/system-environment.nix56
-rw-r--r--nixos/modules/config/timezone.nix2
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/environment.nix9
-rw-r--r--nixos/modules/security/ca.nix8
-rw-r--r--nixos/modules/security/pam.nix1
-rw-r--r--nixos/modules/security/sudo.nix3
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix2
10 files changed, 12 insertions, 73 deletions
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index 7a7d713ef687..8182b8ae8081 100644
--- a/nixos/modules/config/i18n.nix
+++ b/nixos/modules/config/i18n.nix
@@ -76,7 +76,7 @@ in
 
     environment.systemPackages = [ glibcLocales ];
 
-    environment.systemVariables =
+    environment.variables =
       { LANG = config.i18n.defaultLocale;
         LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
       };
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index e3ddf9e3c5fa..9e212847e489 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -19,7 +19,6 @@ in
       default = {};
       description = ''
         A set of environment variables used in the global environment.
-        These variables will be set on shell initialisation.
         The value of each variable can be either a string or a list of
         strings.  The latter is concatenated, interspersed with colon
         characters.
diff --git a/nixos/modules/config/system-environment.nix b/nixos/modules/config/system-environment.nix
deleted file mode 100644
index b30c4e064750..000000000000
--- a/nixos/modules/config/system-environment.nix
+++ /dev/null
@@ -1,56 +0,0 @@
-# This module defines a system-wide environment that will be
-# initialised by pam_env (that is, not only in shells).
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
-
-  cfg = config.environment;
-
-in
-
-{
-
-  options = {
-
-    environment.systemVariables = mkOption {
-      default = {};
-      description = ''
-        A set of environment variables used in the global environment.
-        These variables will be set by PAM.
-        The value of each variable can be either a string or a list of
-        strings.  The latter is concatenated, interspersed with colon
-        characters.
-      '';
-      type = types.attrsOf (mkOptionType {
-        name = "a string or a list of strings";
-        merge = loc: defs:
-          let
-            defs' = filterOverrides defs;
-            res = (head defs').value;
-          in
-          if isList res then concatLists (getValues defs')
-          else if lessThan 1 (length defs') then
-            throw "The option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}."
-          else if !isString res then
-            throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}."
-          else res;
-      });
-      apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v);
-    };
-
-  };
-
-  config = {
-
-    system.build.pamEnvironment = pkgs.writeText "pam-environment"
-       ''
-         ${concatStringsSep "\n" (
-           (mapAttrsToList (n: v: ''${n}="${concatStringsSep ":" v}"'')
-             (zipAttrsWith (const concatLists) ([ (mapAttrs (n: v: [ v ]) cfg.systemVariables) ]))))}
-       '';
-
-  };
-
-}
diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix
index 4f7fc9ab262b..65703d8bb080 100644
--- a/nixos/modules/config/timezone.nix
+++ b/nixos/modules/config/timezone.nix
@@ -30,7 +30,7 @@ in
 
   config = {
 
-    environment.systemVariables.TZDIR = "/etc/zoneinfo";
+    environment.variables.TZDIR = "/etc/zoneinfo";
 
     systemd.globalEnvironment.TZDIR = tzdir;
 
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index a6e0e0186695..4ceb48989beb 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -14,7 +14,6 @@
   ./config/power-management.nix
   ./config/pulseaudio.nix
   ./config/shells-environment.nix
-  ./config/system-environment.nix
   ./config/swap.nix
   ./config/sysctl.nix
   ./config/system-path.nix
diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix
index c26c962b20a6..aa9aec078342 100644
--- a/nixos/modules/programs/environment.nix
+++ b/nixos/modules/programs/environment.nix
@@ -19,16 +19,13 @@ in
     environment.variables =
       { LOCATE_PATH = "/var/cache/locatedb";
         NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix";
-        PAGER = "less -R";
-        EDITOR = "nano";
-      };
-
-    environment.systemVariables =
-      { NIX_PATH =
+        NIX_PATH =
           [ "/nix/var/nix/profiles/per-user/root/channels/nixos"
             "nixpkgs=/etc/nixos/nixpkgs"
             "nixos-config=/etc/nixos/configuration.nix"
           ];
+        PAGER = "less -R";
+        EDITOR = "nano";
       };
 
     environment.profiles =
diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix
index 57764dc870f3..f159e359f968 100644
--- a/nixos/modules/security/ca.nix
+++ b/nixos/modules/security/ca.nix
@@ -12,11 +12,9 @@ with lib;
         }
       ];
 
-    environment.systemVariables =
-      { OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
-        CURL_CA_BUNDLE         = "/etc/ssl/certs/ca-bundle.crt";
-        GIT_SSL_CAINFO         = "/etc/ssl/certs/ca-bundle.crt";
-      };
+    environment.variables.OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
+    environment.variables.CURL_CA_BUNDLE = "/etc/ssl/certs/ca-bundle.crt";
+    environment.variables.GIT_SSL_CAINFO = "/etc/ssl/certs/ca-bundle.crt";
 
   };
 
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 02340fd78e8c..6a5eb4c720f8 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -186,7 +186,6 @@ let
               "password optional ${pkgs.samba}/lib/security/pam_smbpass.so nullok use_authtok try_first_pass"}
 
           # Session management.
-          session required pam_env.so envfile=${config.system.build.pamEnvironment}
           session required pam_unix.so
           ${optionalString cfg.setLoginUid
               "session required pam_loginuid.so"}
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index e8ed545c8cc7..cce1e785563b 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -58,6 +58,9 @@ in
         # Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
 
         # Environment variables to keep for root and %wheel.
+        Defaults:root,%wheel env_keep+=LOCALE_ARCHIVE
+        Defaults:root,%wheel env_keep+=NIX_CONF_DIR
+        Defaults:root,%wheel env_keep+=NIX_PATH
         Defaults:root,%wheel env_keep+=TERMINFO_DIRS
         Defaults:root,%wheel env_keep+=TERMINFO
 
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index f373657b7918..4bfd6268234d 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -318,7 +318,7 @@ in
       };
 
     # Set up the environment variables for running Nix.
-    environment.systemVariables = cfg.envVars;
+    environment.variables = cfg.envVars;
 
     environment.extraInit =
       ''