2021-02-14 02:38:20 +00:00
|
|
|
# Users
|
|
|
|
|
2021-04-19 02:26:27 +00:00
|
|
|
Users are a special case of [profiles](profiles.md) that define system
|
2021-02-14 02:38:20 +00:00
|
|
|
users and [home-manager][home-manager] configurations. For your convenience,
|
|
|
|
home manager is wired in by default so all you have to worry about is declaring
|
|
|
|
your users. For a fully fleshed out example, check out the developers personal
|
2021-02-18 01:31:33 +00:00
|
|
|
[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix).
|
2021-02-14 02:38:20 +00:00
|
|
|
|
|
|
|
## Basic Usage
|
|
|
|
`users/myuser/default.nix`:
|
|
|
|
```nix
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
users.users.myuser = {
|
|
|
|
isNormalUser = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager.users.myuser = {
|
|
|
|
programs.mpv.enable = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2021-03-23 14:44:57 +00:00
|
|
|
## Home Manager
|
|
|
|
Home Manager support follows the same principles as regular nixos configurations.
|
2021-04-19 02:26:27 +00:00
|
|
|
All modules defined in [user modules][modules-list] will be imported to
|
|
|
|
Home Manager. All profiles are availabe in [suites][suites] as userProfiles.
|
2021-03-23 14:44:57 +00:00
|
|
|
The `userSuites` output will be available in your Home Manager Configuration as
|
|
|
|
the special argument, `suites`.
|
|
|
|
|
2021-02-14 02:38:20 +00:00
|
|
|
## External Usage
|
|
|
|
You can easily use the defined home-manager configurations outside of NixOS
|
2021-04-19 02:26:27 +00:00
|
|
|
using the `homeConfigurations` flake output. The [flk](../flk/index.md) helper
|
2021-03-23 14:44:57 +00:00
|
|
|
script makes this even easier.
|
2021-02-14 02:38:20 +00:00
|
|
|
|
|
|
|
This is great for keeping your environment consistent across Unix systems,
|
|
|
|
including OSX.
|
|
|
|
|
|
|
|
### From within the projects devshell:
|
|
|
|
```sh
|
|
|
|
# builds the nixos user defined in the NixOS host
|
|
|
|
flk home NixOS nixos
|
|
|
|
|
|
|
|
# build and activate
|
|
|
|
flk home NixOS nixos switch
|
|
|
|
```
|
|
|
|
|
|
|
|
### Manually from outside the project:
|
|
|
|
```sh
|
|
|
|
# build
|
2021-03-23 14:37:11 +00:00
|
|
|
nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
|
2021-02-14 02:38:20 +00:00
|
|
|
|
|
|
|
# activate
|
|
|
|
./result/activate && unlink result
|
|
|
|
```
|
|
|
|
|
|
|
|
[home-manager]: https://nix-community.github.io/home-manager
|
2021-04-19 02:26:27 +00:00
|
|
|
[suites]: https://github.com/divnix/devos/tree/core/suites/default.nix
|
|
|
|
[modules-list]: https://github.com/divnix/devos/tree/core/modules/module-list.nix
|