Skip to content

Commit 4fee78f

Browse files
committed
doc: add users to mdbook
1 parent 2cd4d7f commit 4fee78f

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

doc/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
- [Hosts](./layout/hosts.md)
99
- [Profiles](./layout/profiles.md)
1010
- [Suites](./layout/suites.md)
11+
- [Users](./layout/users.md)

doc/src/layout/users.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Users
2+
3+
Users are a special case of [profiles](./profiles.md) that define system users
4+
and [home-manager][home-manager] configurations. For your convenience, home
5+
manager is wired in by default so all you have to worry about is declaring your
6+
users. For a fully fleshed out example, check out the developers personal
7+
[branch](https://github.com/nrdxp/nixflk/tree/nrd/users/nrd/default.nix).
8+
9+
## Basic Usage
10+
`users/myuser/default.nix`:
11+
```nix
12+
{ ... }:
13+
{
14+
users.users.myuser = {
15+
isNormalUser = true;
16+
};
17+
18+
home-manager.users.myuser = {
19+
programs.mpv.enable = true;
20+
};
21+
};
22+
23+
```
24+
25+
## External Usage
26+
You can easily use the defined home-manager configurations outside of NixOS
27+
using the `hmActivations` meta-package defined in the flakes `legacyPackages`
28+
output. The [flk](../flk/flk.md) helper script makes this even easier. Just
29+
make sure you have home-manager
30+
[installed](https://nix-community.github.io/home-manager/index.html#ch-installation).
31+
32+
This is great for keeping your environment consistent across Unix systems,
33+
including OSX.
34+
35+
### From within the projects devshell:
36+
```sh
37+
# builds the nixos user defined in the NixOS host
38+
flk home NixOS nixos
39+
40+
# activate
41+
flk home NixOS nixos switch
42+
```
43+
44+
### Manually from outside the project:
45+
```sh
46+
# build
47+
nix build "github:nrdxp/nixflk#hmActivationPackages.NixOS.nixos"
48+
49+
# activate
50+
./result/activate && unlink result
51+
```
52+
53+
[home-manager]: https://nix-community.github.io/home-manager

users/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../doc/src/layout/users.md

0 commit comments

Comments
 (0)