nixos-config/lib/nixos.nix

34 lines
813 B
Nix
Raw Normal View History

# All of the functions suitable only for NixOS.
{ lib }:
rec {
2022-12-10 10:47:34 +00:00
# This is only used for home-manager users without a NixOS user counterpart.
mapHomeManagerUser = user: settings:
let
homeDirectory = "/home/${user}";
defaultUserConfig = {
extraGroups = lib.mkDefault [ "wheel" ];
createHome = lib.mkDefault true;
home = lib.mkDefault homeDirectory;
isNormalUser = lib.mkForce true;
};
2022-11-19 03:05:31 +00:00
in
({ lib, ... }: {
home-manager.users."${user}" = { ... }: {
imports = [
{
home.username = user;
home.homeDirectory = homeDirectory;
}
../configs/home-manager/${user}
];
};
users.users."${user}" = lib.mkMerge [
defaultUserConfig
settings
];
});
}