nixos-config/lib/nixos.nix

34 lines
839 B
Nix
Raw Normal View History

# All of the functions suitable only for NixOS.
2024-02-25 14:27:05 +00:00
{ pkgs, 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 = {
2024-02-25 14:27:05 +00:00
extraGroups = pkgs.lib.mkDefault [ "wheel" ];
createHome = pkgs.lib.mkDefault true;
home = pkgs.lib.mkDefault homeDirectory;
isNormalUser = pkgs.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
];
});
}