{ config, lib, pkgs, self, ... }:

let
  cfg = config.samfelag.modules.user;
in
{
  options.samfelag.modules.user = {
    name = lib.mkOption {
      type = lib.types.str;
      default = "marc";
      description = ''
        Specifies the user name
      '';
    };
  };

  config = lib.mkMerge [
    {
      programs.zsh.enable = true;

      users = {
        defaultUserShell = pkgs.zsh;
        users."${cfg.name}" = with cfg; {
          description = "Marc Sastre Rienitz";
          isNormalUser = true;
	  extraGroups = [ "networkmanager" "wheel" ];
        };

        # Do not allow users to be added or modified except through Nix configuration.
        # mutableUsers = false;
      };

      nix.settings.trusted-users = [ "${cfg.name}" ];
    }
  ];
}
