The Rambam · Sefer Zemanim
הלכות שופר וסוכה ולולב ו׳Shofar, Sukkah and Lulav 6
Chapter 6 of 8 in Shofar, Sukkah and Lulav — 16 halachot
Halacha 1א׳
נָּשִׁים וַעֲבָדִים וּקְטַנִּים פְּטוּרִים מִן הַסֻּכָּה. טֻמְטוּם וְאַנְדְּרוֹגִינוּס חַיָּבִים מִסָּפֵק. וְכֵן מִי שֶׁחֶצְיוֹ עֶבֶד וְחֶצְיוֹ בֶּן חוֹרִין חַיָּב. קָטָן שֶׁאֵינוֹ צָרִיךְ לְאִמּוֹ שֶׁהוּא [כְּבֶן חָמֵשׁ] כְּבֶן שֵׁשׁ חַיָּב בְּסֻכָּה מִדִּבְרֵי סוֹפְרִים כְּדֵי לְחַנְּכוֹ בְּמִצְוֹת:
Women, slaves and minors are exempt from the [commandment of dwelling in a] sukkah. One whose genitalia are covered by a layer of skin (and, so, undetermined) and one who has genitalia of both sexes are obligated based on the doubt [about their sex]. And likewise is one who is half a slave and half a free person obligated. A minor who does not [still] require his mother — which is [like a five-year old] like a six-year old — is obligated in the [commandment of dwelling in a] sukkah by the words of the Scribes (rabbinically), in order to educate them in the commandments.
Halacha 2ב׳
חוֹלִים וּמְשַׁמְּשֵׁיהֶן פְּטוּרִים מִן הַסֻּכָּה. וְלֹא חוֹלֶה שֶׁיֵּשׁ בּוֹ סַכָּנָה אֶלָּא אֲפִלּוּ חָשׁ בְּרֹאשׁוֹ וַאֲפִלּוּ חָשׁ בְּעֵינָיו. מִצְטַעֵר פָּטוּר מִן הַסֻּכָּה הוּא וְלֹא מְשַׁמְּשָׁיו. וְאֵיזֶהוּ מִצְטַעֵר זֶה שֶׁאֵינוֹ יָכוֹל לִישֹׁן בַּסֻּכָּה מִפְּנֵי הָרוּחַ אוֹ מִפְּנֵי הַזְּבוּבִים וְהַפַּרְעוֹשִׁים וְכַיּוֹצֵא בָּהֶן אוֹ מִפְּנֵי הָרֵיחַ:
Sick people and those serving them are exempt from the sukkah — and not just a sick person in danger, but even one whose head feels unwell or his eye feels unwell. One who is indisposed is exempt from the sukkah — he, but not those serving him. And what is [the criteria by which one is determined to be] indisposed? That is one who is not able to sleep in the sukkah because of the wind, or because of the flies and the fleas and that which is similar to them or because of the smell.
Halacha 3ג׳
הָאָבֵל חַיָּב בְּסֻכָּה. וְחָתָן וְכָל הַשּׁוֹשְׁבִינִין וְכָל בְּנֵי חֻפָּה פְּטוּרִים מִן הַסֻּכָּה כָּל שִׁבְעַת יְמֵי הַמִּשְׁתֶּה:
A mourner is obligated [to dwell] in the sukkah. But a groom, the groomsmen and all the members of the [wedding party] are exempt from the sukkah all seven days of the feast [connected to the wedding].
Mishneh Torah, Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Edition, tr. R. Francis Nataf, 2019 — CC BY