2022-07-09 05:46:06 +00:00
|
|
|
# This is just a library intended solely for this flake.
|
|
|
|
# It is expected to use the nixpkgs library with `lib/default.nix`.
|
|
|
|
{ lib }:
|
|
|
|
|
|
|
|
rec {
|
2022-12-10 10:47:34 +00:00
|
|
|
# This is only used for home-manager users without a NixOS user counterpart.
|
2022-07-09 05:54:05 +00:00
|
|
|
mapHomeManagerUser = user: settings:
|
|
|
|
let
|
2022-08-06 05:58:24 +00:00
|
|
|
homeDirectory = "/home/${user}";
|
2022-07-09 05:54:05 +00:00
|
|
|
defaultUserConfig = {
|
2022-11-26 02:53:42 +00:00
|
|
|
extraGroups = lib.mkDefault [ "wheel" ];
|
|
|
|
createHome = lib.mkDefault true;
|
|
|
|
home = lib.mkDefault homeDirectory;
|
|
|
|
isNormalUser = lib.mkForce true;
|
2022-07-09 05:54:05 +00:00
|
|
|
};
|
2022-11-19 03:05:31 +00:00
|
|
|
in
|
2023-10-03 13:33:16 +00:00
|
|
|
({ lib, ... }: {
|
2022-08-06 05:58:24 +00:00
|
|
|
home-manager.users."${user}" = { ... }: {
|
2023-10-28 04:23:24 +00:00
|
|
|
imports = [
|
|
|
|
{
|
|
|
|
home.username = user;
|
|
|
|
home.homeDirectory = homeDirectory;
|
|
|
|
}
|
|
|
|
|
2024-01-14 23:45:43 +00:00
|
|
|
(getConfig "home-manager" user)
|
2023-10-28 04:23:24 +00:00
|
|
|
];
|
2022-08-06 05:58:24 +00:00
|
|
|
};
|
2023-10-03 13:33:16 +00:00
|
|
|
|
|
|
|
users.users."${user}" = lib.mkMerge [
|
|
|
|
defaultUserConfig
|
|
|
|
settings
|
|
|
|
];
|
|
|
|
});
|
2022-07-09 05:54:05 +00:00
|
|
|
|
2024-01-14 23:45:43 +00:00
|
|
|
getConfig = type: config: ../configs/${type}/${config};
|
|
|
|
|
|
|
|
getUser = type: user: ../configs/${type}/_users/${user};
|
2022-07-09 05:46:06 +00:00
|
|
|
}
|