From 7eb5106548eaab99ebeb21c87f93092de54fe931 Mon Sep 17 00:00:00 2001 From: Nicolas Berbiche Date: Thu, 20 Jan 2022 00:52:49 -0500 Subject: [PATCH] docs: fix README flake commands The README is corrected to mention using `home-manager switch --flake` with Nix Flakes. --- README.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b47e39455..196c0d43b 100644 --- a/README.md +++ b/README.md @@ -104,9 +104,10 @@ as follows: inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; + # nix-darwin.url = "github:lnl7/nix-darwin"; }; - outputs = { home-manager, nixpkgs, ... }: { + outputs = inputs@{ home-manager, nixpkgs, ... }: { nixosConfigurations = { hostname = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -124,10 +125,31 @@ as follows: ]; }; }; + + # You do not need this unless you are using the nix-darwin project + darwinConfigurations = { + hostname = inputs.nix-darwin.lib.darwinSystem { + system = "x86_64-darwin"; + modules = [ + ./configuration.nix + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jdoe = import ./home.nix; + } + ]; + }; + }; }; } ``` +The Home Manager configuration is then part of the NixOS/Darwin configuration +and is automatically rebuilt with the system when using the appropriate command +for the system, such as `nixos-rebuild switch --flake ` for NixOS, +and `darwin-rebuild switch --flake ` with nix-darwin. + If you are not using NixOS you can place the following flake in `~/.config/nixpkgs/flake.nix` to load your standard Home Manager configuration: @@ -158,9 +180,8 @@ configuration: Note, the Home Manager library is exported by the flake under `lib.hm`. -When using flakes, switch to new configurations as you do for the -whole system (e. g. `nixos-rebuild switch --flake `) instead of -using the `home-manager` command line tool. +When using flakes, switch to new configurations with +`home-manager switch --flake `. Releases --------