niksos/modules/other/home-manager.nix

38 lines
1 KiB
Nix

{
config,
config',
inputs,
lib,
self,
...
}: with lib; let
cfg = config.myOptions.other.home-manager;
in {
options.myOptions.other.home-manager = {
enable = mkEnableOption "enable home-manager";
enableDirenv = mkEnableOption "enable direnv";
};
config = mkIf cfg.enable {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {inherit inputs self config';};
users.${config'.username} = {
programs = {
home-manager.enable = true;
direnv = mkIf cfg.enableDirenv {
enable = true;
nix-direnv.enable = true;
};
};
home = {
inherit (config') username;
homeDirectory = "/home/${config'.username}";
stateVersion = lib.mkDefault "23.11";
};
};
};
};
}