mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 10:58:02 +00:00
Gabriel Arazas
0760acb676
Now we're going beyond these structuring as we might have to accomodate non-system configurations like Nixvim.
39 lines
1009 B
Nix
39 lines
1009 B
Nix
# This is just a library intended solely for this flake.
|
|
# It is expected to use the nixpkgs library with `lib/default.nix`.
|
|
{ lib }:
|
|
|
|
rec {
|
|
# 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;
|
|
};
|
|
in
|
|
({ lib, ... }: {
|
|
home-manager.users."${user}" = { ... }: {
|
|
imports = [
|
|
{
|
|
home.username = user;
|
|
home.homeDirectory = homeDirectory;
|
|
}
|
|
|
|
(getConfig "home-manager" user)
|
|
];
|
|
};
|
|
|
|
users.users."${user}" = lib.mkMerge [
|
|
defaultUserConfig
|
|
settings
|
|
];
|
|
});
|
|
|
|
getConfig = type: config: ../configs/${type}/${config};
|
|
|
|
getUser = type: user: ../configs/${type}/_users/${user};
|
|
}
|