@@ -1649,6 +1649,50 @@ def test_openeuler_os_grains():
16491649 _run_os_grains_tests (_os_release_data , {}, expectation )
16501650
16511651
1652+ @pytest .mark .skip_unless_on_linux
1653+ def test_nixos_os_grains ():
1654+ """
1655+ Test that OS grains are parsed correctly for NixOS
1656+ """
1657+ # /etc/os-release data taken from NixOS 25.05
1658+ _os_release_data = {
1659+ "ANSI_COLOR" : "0;38;2;126;186;228" ,
1660+ "BUG_REPORT_URL" : "https://github.com/NixOS/nixpkgs/issues" ,
1661+ "BUILD_ID" : "25.05.807313.59e69648d345" ,
1662+ "CPE_NAME" : "cpe:/o:nixos:nixos:25.05" ,
1663+ "DEFAULT_HOSTNAME" : "nixos" ,
1664+ "DOCUMENTATION_URL" : "https://nixos.org/learn.html" ,
1665+ "HOME_URL" : "https://nixos.org/" ,
1666+ "ID" : "nixos" ,
1667+ "ID_LIKE" : "" ,
1668+ "IMAGE_ID" : "" ,
1669+ "IMAGE_VERSION" : "" ,
1670+ "LOGO" : "nix-snowflake" ,
1671+ "NAME" : "NixOS" ,
1672+ "PRETTY_NAME" : "NixOS 25.05 (Warbler)" ,
1673+ "SUPPORT_END" : "2025-12-31" ,
1674+ "SUPPORT_URL" : "https://nixos.org/community.html" ,
1675+ "VARIANT" : "" ,
1676+ "VARIANT_ID" : "" ,
1677+ "VENDOR_NAME" : "NixOS" ,
1678+ "VENDOR_URL" : "https://nixos.org/" ,
1679+ "VERSION" : "25.05 (Warbler)" ,
1680+ "VERSION_CODENAME" : "warbler" ,
1681+ "VERSION_ID" : "25.05" ,
1682+ }
1683+ expectation = {
1684+ "os" : "NixOS" ,
1685+ "os_family" : "NixOS" ,
1686+ "oscodename" : "warbler" ,
1687+ "osfullname" : "NixOS" ,
1688+ "osrelease" : "25.05" ,
1689+ "osrelease_info" : (25 , 5 ),
1690+ "osmajorrelease" : 25 ,
1691+ "osfinger" : "NixOS-25.05" ,
1692+ }
1693+ _run_os_grains_tests (_os_release_data , {}, expectation )
1694+
1695+
16521696@pytest .mark .skip_unless_on_windows
16531697def test_windows_platform_data ():
16541698 """
0 commit comments