mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-01 04:57:55 +00:00
63 lines
2.5 KiB
Plaintext
63 lines
2.5 KiB
Plaintext
---
|
|
title: Declarative user management
|
|
---
|
|
= Declarative user management
|
|
|
|
Similarly to xref:../01-declarative-host-management/index.adoc[Declarative host management], this project also provides a way to declare home-manager users.
|
|
The `./setups/home-manager.nix` sits in the project root expecting certain data.
|
|
Similar to the declarative NixOS setup, it expects an attribute set of users with each representing one of the users from github:{github-repo}[`./users/home-manager/`, path=./users/home-manager/, rev=master].
|
|
These are then included as part of `homeConfigurations` for easier installation with the standalone home-manager tool.
|
|
Of which they are then included as part of deploy nodes for deploy-rs (also for easier deployment).
|
|
|
|
Here's an example user with complete schema.
|
|
|
|
.A user with complete schema
|
|
[source, nix]
|
|
----
|
|
{
|
|
foo-dogsquared = {
|
|
systems = [ "x86_64-linux" ];
|
|
nixpkgs-channel = "nixos-stable";
|
|
home-manager-channel = "home-manager-23.05";
|
|
home-directory = "/home/foo-dogsquared";
|
|
username = "foodogsquared";
|
|
modules = [
|
|
({ config, lib, ... }: {
|
|
services.foo.enable = true;
|
|
})
|
|
];
|
|
deploy = {
|
|
hostname = "local.foodogsquared.one";
|
|
ssh-user = "admin";
|
|
profile = "foodogsquared";
|
|
fast-connection = true;
|
|
auto-rollback = true;
|
|
magic-rollback = true;
|
|
remote-build = true;
|
|
};
|
|
};
|
|
}
|
|
----
|
|
|
|
- `systems` contains a list of platforms of the home-manager user.
|
|
This is mainly used to indicate the platform used for the nixpkgs repository.
|
|
|
|
- `nixpkgs-channel` indicates the branch of the nixpkgs to be used.
|
|
By default, this uses the `nixpkgs` which follows the `nixos-unstable` branch.
|
|
|
|
- `home-manager-channel` contains the home-manager channel to be used.
|
|
The value should be one of the home-manager channel that is imported into this flake.
|
|
By default, it sets the home-manager channel at `home-manager` which is pointed at the unstable channel.
|
|
|
|
- `home-directory` is the associated home directory of the home-manager.
|
|
It is set for `config.home.directory` at the home-manager configuration.
|
|
By default, it will be set at `/home/$USERNAME`.
|
|
|
|
- `username` is the username of the home-manager user to be used for `config.home.username` at the home-manager configuration.
|
|
If unset, it will use the table key.
|
|
In the above example, the unset value would be `foo-dogsquared`.
|
|
|
|
- `modules` is an extra list of modules to be imported with the configuration.
|
|
|
|
- `deploy` is pretty similar to the previous configuration setting that it sets certain options for deploy-rs.
|