diff --git a/README.md b/README.md index 55d927a..27e337e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ 4. Add flakes support by appending `nix.settings.experimental-features = ["nix-command" "flakes"];` 5. Rebuild `nixos-rebuild switch` 6. Clone this repo to your destination of choice (I go with ~/.dotfiles for the time being) -7. Install [home-manager](https://nix-community.github.io/home-manager/) -8. Switch to the current version `nixos-rebuild switch --flake . --impure` (Impure, because we do not provide hardware configuration, since it is machine dependant) -9. Switch to the current version of home-manager `home-manager switch --flake .` +7. Switch to the current version `nixos-rebuild switch --flake . --impure` (Impure, because we do not provide hardware configuration, since it is machine dependant) + +Home Manager is included as a NixOS module, so `nixos-rebuild` applies both the +system and the user configuration. There is no separate `home-manager switch` +step, and no home-manager channel is needed. diff --git a/flake.nix b/flake.nix index b364bab..7d5000d 100644 --- a/flake.nix +++ b/flake.nix @@ -11,22 +11,20 @@ let lib = nixpkgs.lib; system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - }; in { nixosConfigurations = { nixos = lib.nixosSystem { inherit system; - modules = [./configuration.nix]; - }; - }; - homeConfigurations = { - leo = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ ./home.nix ]; - }; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.leo = import ./home.nix; + } + ]; + }; }; }; } diff --git a/home.nix b/home.nix index 7628278..1c28ed9 100644 --- a/home.nix +++ b/home.nix @@ -1,10 +1,8 @@ { config, pkgs, ... }: { - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = "leo"; - home.homeDirectory = "/home/leo"; + # home.username and home.homeDirectory are set automatically by the + # Home Manager NixOS module, from the home-manager.users. attribute. # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release @@ -109,7 +107,4 @@ count = "ls -1 | wc -l"; }; }; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; }