Skip to content

Commit

Permalink
nixos/user-profiles.nix: Extract module
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Dec 9, 2021
1 parent 8313fd3 commit 8772485
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
25 changes: 25 additions & 0 deletions nixos/modules/config/user-profiles.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mapAttrs'
filterAttrs
;
in
{
config = {
environment.etc = mapAttrs' (_: { packages, name, ... }: {
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 != []) config.users.users);

environment.profiles = [
"$HOME/.nix-profile"
"/etc/profiles/per-user/$USER"
];
};
}
15 changes: 0 additions & 15 deletions nixos/modules/config/users-groups.nix
Original file line number Diff line number Diff line change
Expand Up @@ -594,21 +594,6 @@ in {
# Install all the user shells
environment.systemPackages = systemShells;

environment.etc = (mapAttrs' (_: { packages, name, ... }: {
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 = [
"$HOME/.nix-profile"
"/etc/profiles/per-user/$USER"
];

assertions = [
{ assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique);
message = "UIDs and GIDs must be unique!";
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
./config/system-path.nix
./config/terminfo.nix
./config/unix-odbc-drivers.nix
./config/user-profiles.nix
./config/users-groups.nix
./config/vte.nix
./config/zram.nix
Expand Down

0 comments on commit 8772485

Please sign in to comment.