niksos/modules/other/home-manager.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

{
config,
inputs,
lib,
self,
...
2024-05-05 12:38:40 +02:00
}: let
cfg = config.myOptions.other.home-manager;
2024-04-14 18:49:29 +02:00
inherit (config.myOptions.other.system) username;
2024-05-05 12:38:40 +02:00
2024-07-25 11:45:44 +02:00
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
in {
options.myOptions.other.home-manager = {
2024-04-05 22:59:32 +02:00
enable = mkEnableOption "home-manager";
enableDirenv = mkEnableOption "direnv";
};
2024-07-15 21:30:03 +02:00
imports = [ inputs.home-manager.nixosModules.home-manager ];
config = mkIf cfg.enable {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {inherit inputs self;};
users.${username} = {
programs = {
home-manager.enable = true;
direnv = mkIf cfg.enableDirenv {
enable = true;
nix-direnv.enable = true;
};
};
home = {
inherit username;
homeDirectory = "/home/${username}";
stateVersion = lib.mkDefault "23.11";
};
};
};
};
}