mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 13:39:46 +01:00
faq: add instructions on targeting multiple logins
Content adapted from https://github.com/rycee/home-manager/issues/394#issuecomment-422958338
This commit is contained in:
parent
0efda9cd6b
commit
b08e6221e0
1 changed files with 40 additions and 0 deletions
40
FAQ.md
40
FAQ.md
|
@ -64,3 +64,43 @@ adding
|
||||||
|
|
||||||
to your `.profile` and `.zshrc` files, respectively. The
|
to your `.profile` and `.zshrc` files, respectively. The
|
||||||
`hm-session-vars.sh` file should work in most Bourne-like shells.
|
`hm-session-vars.sh` file should work in most Bourne-like shells.
|
||||||
|
|
||||||
|
How do set up a configuration for multiple users/machines?
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
A typical way to prepare a repository of configurations for multiple
|
||||||
|
logins and machines is to prepare one "top-level" file for each unique
|
||||||
|
combination.
|
||||||
|
|
||||||
|
For example, if you have two machines, called "kronos" and "rhea" on
|
||||||
|
which you want to configure your user "jane" then you could create the
|
||||||
|
files
|
||||||
|
|
||||||
|
- `kronos-jane.nix`,
|
||||||
|
- `rhea-jane.nix`, and
|
||||||
|
- `common.nix`
|
||||||
|
|
||||||
|
in your repository. On the kronos and rhea machines you can then make
|
||||||
|
`~jane/.config/nixpkgs/home.nix` be a symbolic link to the
|
||||||
|
corresponding file in your configuration repository.
|
||||||
|
|
||||||
|
The `kronos-jane.nix` and `rhea-jane.nix` files follow the format
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./common.nix ];
|
||||||
|
|
||||||
|
# Various options that are specific for this machine/user.
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
while the `common.nix` file contains configuration shared across the
|
||||||
|
two logins. Of course, instead of just a single `common.nix` file you
|
||||||
|
can have multiple ones, even one per program or service.
|
||||||
|
|
||||||
|
You can get some inspiration from the [Post your home-manager home.nix
|
||||||
|
file!][1] Reddit thread.
|
||||||
|
|
||||||
|
[1]: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
|
||||||
|
|
Loading…
Reference in a new issue