summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorJan Malakhovski <oxij@oxij.org>2018-03-20 22:40:57 +0000
committerJan Malakhovski <oxij@oxij.org>2018-03-30 06:40:13 +0000
commit6d7854a9a8711ec375f59ec02668f28be74772a5 (patch)
treee9d011f0fb9d369cc7926d258347f4a51f51c769 /nixos/modules/config
parenta7af5d4f88f9e30bc9b401a84b7cb3cf036fccbb (diff)
downloadnixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.tar
nixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.tar.gz
nixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.tar.bz2
nixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.tar.lz
nixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.tar.xz
nixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.tar.zst
nixlib-6d7854a9a8711ec375f59ec02668f28be74772a5.zip
nixos: users-groups: cleanup
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/users-groups.nix52
1 files changed, 23 insertions, 29 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index 11e969b760e0..36e06e532d6d 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -502,9 +502,6 @@ in {
       };
     };
 
-    # Install all the user shells
-    environment.systemPackages = systemShells;
-
     users.groups = {
       root.gid = ids.gids.root;
       wheel.gid = ids.gids.wheel;
@@ -541,14 +538,29 @@ in {
     # for backwards compatibility
     system.activationScripts.groups = stringAfter [ "users" ] "";
 
-    environment.etc."subuid" = {
-      text = subuidFile;
-      mode = "0644";
-    };
-    environment.etc."subgid" = {
-      text = subgidFile;
-      mode = "0644";
-    };
+    # Install all the user shells
+    environment.systemPackages = systemShells;
+
+    environment.etc = {
+      "subuid" = {
+        text = subuidFile;
+        mode = "0644";
+      };
+      "subgid" = {
+        text = subgidFile;
+        mode = "0644";
+      };
+    } // (mapAttrs' (name: { packages, ... }: {
+      name = "profiles/per-user/${name}";
+      value.source = pkgs.buildEnv {
+        name = "user-environment";
+        paths = packages;
+        inherit (config.environment) pathsToLink extraOutputsToInstall;
+        inherit (config.system.path) ignoreCollisions postBuild;
+      };
+    }) (filterAttrs (_: u: u.packages != []) cfg.users));
+
+    environment.profiles = [ "/etc/profiles/per-user/$USER" ];
 
     assertions = [
       { assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique);
@@ -579,22 +591,4 @@ in {
 
   };
 
-  imports =
-    [ (mkAliasOptionModule [ "users" "extraUsers" ] [ "users" "users" ])
-      (mkAliasOptionModule [ "users" "extraGroups" ] [ "users" "groups" ])
-      {
-        environment = {
-          etc = mapAttrs' (name: { packages, ... }: {
-            name = "profiles/per-user/${name}";
-            value.source = pkgs.buildEnv {
-              name = "user-environment";
-              paths = packages;
-              inherit (config.environment) pathsToLink extraOutputsToInstall;
-              inherit (config.system.path) ignoreCollisions postBuild;
-            };
-          }) (filterAttrs (_: { packages, ... }: packages != []) cfg.users);
-          profiles = ["/etc/profiles/per-user/$USER"];
-        };
-      }
-    ];
 }