{ config, options, lib, home-manager, ... }: with lib; with lib.my; { options = with types; { user = mkOpt attrs { }; home = { configFile = mkOpt' attrs { } "Files to place in $XDG_CONFIG_HOME"; dataFile = mkOpt' attrs { } "Files to place in $XDG_DATA_HOME"; file = mkOpt' attrs { } "Files to place directly in $HOME"; packages = mkOpt' attrs { } "User-level installed packages"; programs = mkOpt' attrs { } "Programs managed directly from home-manager"; services = mkOpt' attrs { } "Services managed directly from home-manager"; }; dconf.settings = mkOpt' attrs { } "dconf settings to enable"; env = mkOption { type = attrsOf (oneOf [ str path (listOf (either str path)) ]); apply = mapAttrs (n: v: if isList v then concatMapStringsSep ":" (x: toString x) v else (toString v)); default = { }; description = ""; }; }; config = { user = let user = builtins.getEnv "USER"; name = if elem user [ "" "root" ] then "jordan" else user; in { inherit name; isNormalUser = true; extraGroups = [ "networkmanager" "wheel" ]; description = "Jordan Holt"; useDefaultShell = true; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILVHTjsyMIV4THNw6yz0OxAxGnC+41gX72UrPqTzR+OS jordan@vimium.com" ]; home = "/home/${name}"; group = "users"; uid = 1000; }; home-manager = { useGlobalPkgs = true; useUserPackages = true; users.${config.user.name} = { home = { file = mkAliasDefinitions options.home.file; stateVersion = config.system.stateVersion; }; programs = mkAliasDefinitions options.home.programs; services = mkAliasDefinitions options.home.services; xdg = { enable = true; configFile = mkAliasDefinitions options.home.configFile; dataFile = mkAliasDefinitions options.home.dataFile; }; dconf.settings = mkAliasDefinitions options.dconf.settings; }; }; users.users.${config.user.name} = mkAliasDefinitions options.user; nixpkgs.config.allowUnfree = true; environment.extraInit = concatStringsSep "\n" (mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.env); }; }