{ description = "Home Manager configuration of john"; inputs = { # Specify the source of Home Manager and Nixpkgs. nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, home-manager, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; lib = pkgs.lib; # Define a module that contains the user option userModule = { config, ... }: { options.user = lib.mkOption { type = lib.types.str; description = "The username for the Home Manager configuration."; default = "john"; }; }; # Evaluate the module to get the config moduleEval = lib.evalModules { modules = [ userModule ]; }; username = moduleEval.config.user; in { homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { inherit pkgs; # Specify your home configuration modules here, for example, # the path to your home.nix. modules = [ ./home.nix userModule # Include the user module in Home Manager modules too ]; # Optionally use extraSpecialArgs # to pass through arguments to home.nix }; }; }