nixos-config/hosts
Gabriel Arazas 6b481a163a Restructure the modules
While it is easier to maintain the modules by prefixing them all with
`modules`, it is not easy when used from other flakes and/or modules.
This is my attempt on making it easier with appropriate namespaces.

Update home-manager user from the restructure
2022-01-09 19:44:09 +08:00
..
ni Restructure the modules 2022-01-09 19:44:09 +08:00
README.adoc Update documentation 2021-12-21 14:29:27 +08:00

These are NixOS configurations that are specific to a machine (e.g., desktop, servers, VM, containers). Ideally, it should be made minimal as much as possible considering you also have to manage your users.

Integrating with custom modules

The host configurations placed here most likely use the custom NixOS modules. The custom modules shouldnt be imported manually from the host. In the case for our flake configuration, the importing of modules are already taken care of — specifically through mkHost from ../lib/flake-utils (see the linked file for the implementation).

It is best practice to assume the host configurations make use of the custom NixOS modules, custom packages, and the flake inputs. In other words, always pay attention to ../flake.nix.

User management

For managing users, there are multiple ways to manage them with this config:

  • The usual users.users.${user} from system configuration (see man configuration.nix.5).

  • If you intend to import users from the ../users/nixos/, you can simply import them through imports in the system module.

    For a convenient option, there is the function getUsers defined from the custom library. You can use it as follows:

    imports = [ # Your modules ]
        # Import the following NixOS users.
        ++ (lib.attrValues (lib.getUsers "nixos" [ "foo-dogsquared" "polski" ]));
  • modules.users.users.${user} which is my implementation for managing users from ../users/home-manager/ — e.g., modules.users.users.foo-dogsquared = {}. This is integrating my home-manager users to map into NixOS users.