/etc/profiles/per-user/$USER

What is the significance of the directory /etc/profiles/per-user/$USER? It doesn’t seem to exist on my NixOS system, but it’s added to $NIX_PROFILES (via the NixOS option environment.profiles) by the following code from nixos/modules/config/users-groups.nix in nixpkgs:

    environment.profiles = [
      "$HOME/.nix-profile"
      "/etc/profiles/per-user/$USER"
    ];

I don’t see any mention of it in the NixOS manual, nixpkgs manual, nix manual, nixpkgs source code, or nix source code (except the above snippet from the nixpkgs source code).

/etc/profiles/per-user/$USER get created when you configure per user packages.

     isNormalUser = true;
     packages = [ 
        pkgs.coway
        ];
   };

Maybe that should be documented somewhere, it’s quite automagical.

A unrelated bug to your questions that was fixed , thats also good for info/reference.

https://github.com/NixOS/nixpkgs/issues/107353

2 Likes