my over complex system configurations
dotfiles.isabelroses.com/
nixos
nix
flake
dotfiles
linux
1{ lib, config, ... }:
2let
3 inherit (lib.lists) optional;
4 inherit (lib.options) mkOption;
5 inherit (lib.types) enum listOf str;
6in
7{
8 options.garden.system = {
9 mainUser = mkOption {
10 type = enum config.garden.system.users;
11 description = "The username of the main user for your system";
12 default = builtins.elemAt config.garden.system.users 0;
13 };
14
15 users = mkOption {
16 type = listOf str;
17 default = [ "isabel" ];
18 description = ''
19 A list of users that you wish to declare as your non-system users. The first username
20 in the list will be treated as your main user unless {option}`garden.system.mainUser` is set.
21 '';
22 };
23 };
24
25 config = {
26 warnings = optional (config.garden.system.users == [ ]) ''
27 You have not added any users to be supported by your system. You may end up with an unbootable system!
28
29 Consider setting {option}`config.garden.system.users` in your configuration
30 '';
31 };
32}