provide per-user args (ie username)

This commit is contained in:
do butterflies cry? 2026-03-07 19:29:26 +10:00
parent 169bf2bf48
commit 34a8c23537
Signed by: cry
GPG key ID: F68745A836CA0412

View file

@ -12,18 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{
root,
config,
lib,
_cerulean,
config,
root,
lib,
...
} @ args: let
inherit
(builtins)
attrNames
filter
pathExists
;
inherit
(lib)
filterAttrs
mapAttrs
;
in {
imports = [
_cerulean.homeManager.nixosModules.default
@ -49,13 +53,21 @@ in {
config = {
home-manager = {
useUserPackages = lib.mkDefault false;
useGlobalPkgs = lib.mkDefault true;
overwriteBackup = lib.mkDefault false;
backupFileExtension = lib.mkDefault "bak";
users =
config.users.users
|> attrNames
|> filter (x: x.manageHome && pathExists /${root}/homes/${x})
|> (x:
lib.genAttrs x (y:
import /${root}/homes/${y}));
|> filterAttrs (name: value: value.manageHome && pathExists /${root}/homes/${name})
|> mapAttrs (name: _: {
imports = [import /${root}/homes/${name}];
# per-user arguments
_module.args.username = name;
});
extraSpecialArgs = _cerulean.specialArgs;
sharedModules = [