nixos-config/hosts
2022-04-17 22:33:04 +08:00
..
bootstrap Modularize nixos user 2022-02-05 18:52:19 +08:00
graphical-installer profiles/desktop: rename into profiles/system 2022-04-17 11:00:38 +08:00
ni profiles/system: add auto-upgrade option 2022-04-17 22:33:04 +08:00
README.adoc docs: update 2022-04-15 21:39:01 +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.nix (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.