diff --git a/packages/zephyr/default.nix b/packages/zephyr/default.nix index 238b1dc..76987a6 100644 --- a/packages/zephyr/default.nix +++ b/packages/zephyr/default.nix @@ -1,5 +1,7 @@ -{ callPackage, stdenv, lib }: -let assets = lib.importJSON ./assets.json; +{ callPackage, stdenv, lib, fetchFromGitHub }: +let + assets = lib.importJSON ./assets.json; + modules = lib.importJSON ./modules.json; in { host-tools = callPackage ./host-tools.nix { inherit (assets) version hosts; @@ -16,4 +18,7 @@ in { inherit (assets) version hosts; source = assets.sdk; }; + + src = fetchFromGitHub modules.zephyr; + modules = lib.mapAttrs (_: fetchFromGitHub) modules.modules; } diff --git a/packages/zephyr/modules.json b/packages/zephyr/modules.json new file mode 100644 index 0000000..9d5e223 --- /dev/null +++ b/packages/zephyr/modules.json @@ -0,0 +1 @@ +{"version": "3.5.0", "zephyr": {"name": "zephyr", "owner": "zephyrproject-rtos", "repo": "zephyr", "rev": "v3.5.0", "sha256": "sha256-72QFsKOWkF6BiP4XgZAXXSBcN4t6yvhAeXCpgCYrhe8="}, "modules": {"acpica": {"name": "acpica", "owner": "zephyrproject-rtos", "repo": "acpica", "rev": "0333c2af13179f9b33d495cf7cb9a509f751cbb1", "sha256": "sha256-PJIeRTeErD/xhYMxxwZ5DUZqX9Xucbq1clLHaHQkBhE="}, "bsim": {"name": "babblesim-manifest", "owner": "zephyrproject-rtos", "repo": "babblesim-manifest", "rev": "384a091445c57b44ac8cbd18ebd245b47c71db94", "sha256": "sha256-bH2eLkhUkw0DwX5TjTIW4kSLksSaoCYiPCLXjD9Rqhg="}, "babblesim_base": {"name": "base", "owner": "BabbleSim", "repo": "base", "rev": "19d62424c0802c6c9fc15528febe666e40f372a1", "sha256": "sha256-/Oi/bDeiZQbZJQYGguQ4UadY9jYq3T8d15/cL/I+UnU="}, "babblesim_ext_2G4_libPhyComv1": {"name": "ext_2G4_libPhyComv1", "owner": "BabbleSim", "repo": "ext_2G4_libPhyComv1", "rev": "9018113a362fa6c9e8f4b9cab9e5a8f12cc46b94", "sha256": "sha256-KvK9vaY9/aRKcrk/Kx1vtYcprQYxjTJKzyTFsL7sUvw="}, "babblesim_ext_2G4_phy_v1": {"name": "ext_2G4_phy_v1", "owner": "BabbleSim", "repo": "ext_2G4_phy_v1", "rev": "d47c6dd90035b41b14f6921785ccb7b8484868e2", "sha256": "sha256-S0DLNVIDGuXVYYGg1uxrRFKP+Gt9MN2H3wDLaxof8wY="}, "babblesim_ext_2G4_channel_NtNcable": {"name": "ext_2G4_channel_NtNcable", "owner": "BabbleSim", "repo": "ext_2G4_channel_NtNcable", "rev": "20a38c997f507b0aa53817aab3d73a462fff7af1", "sha256": "sha256-bh65lHKQ68vBT55Y/TOSC7csNDZ6+1ew+K7eR9Blrxk="}, "babblesim_ext_2G4_channel_multiatt": {"name": "ext_2G4_channel_multiatt", "owner": "BabbleSim", "repo": "ext_2G4_channel_multiatt", "rev": "bde72a57384dde7a4310bcf3843469401be93074", "sha256": "sha256-JLt2QPyPab3uGmEfCZEdI6jRye+Kdvu5Mi3fRINryFs="}, "babblesim_ext_2G4_modem_magic": {"name": "ext_2G4_modem_magic", "owner": "BabbleSim", "repo": "ext_2G4_modem_magic", "rev": "cb70771794f0bf6f262aa474848611c68ae8f1ed", "sha256": "sha256-/vHHor78Zyqk7lnsbrAtuLQ+J1L+lbFI/MPaChvmHp4="}, "babblesim_ext_2G4_modem_BLE_simple": {"name": "ext_2G4_modem_BLE_simple", "owner": "BabbleSim", "repo": "ext_2G4_modem_BLE_simple", "rev": "809ab073159c9ab6686c2fea5749b0702e0909f7", "sha256": "sha256-j2ENSwQ5aOweNTEW0OZkZKpPYYHyGs7NYsaE8aDHxlY="}, "babblesim_ext_2G4_device_burst_interferer": {"name": "ext_2G4_device_burst_interferer", "owner": "BabbleSim", "repo": "ext_2G4_device_burst_interferer", "rev": "5b5339351d6e6a2368c686c734dc8b2fc65698fc", "sha256": "sha256-JikW/YdhTxhLAFQYq2i9Sx4kJjHrTW3Altr6ajtftZw="}, "babblesim_ext_2G4_device_WLAN_actmod": {"name": "ext_2G4_device_WLAN_actmod", "owner": "BabbleSim", "repo": "ext_2G4_device_WLAN_actmod", "rev": "9cb6d8e72695f6b785e57443f0629a18069d6ce4", "sha256": "sha256-5TRYGe0TXcbrxvHFS0p0u6nlrfLcV+FAwiFY0doGqzQ="}, "babblesim_ext_2G4_device_playback": {"name": "ext_2G4_device_playback", "owner": "BabbleSim", "repo": "ext_2G4_device_playback", "rev": "85c645929cf1ce995d8537107d9dcbd12ed64036", "sha256": "sha256-hjoWX2rLmXPdpXQIzqUfmraTDv+iDyU7YHMdzh4Gf/w="}, "babblesim_ext_libCryptov1": {"name": "ext_libCryptov1", "owner": "BabbleSim", "repo": "ext_libCryptov1", "rev": "eed6d7038e839153e340bd333bc43541cb90ba64", "sha256": "sha256-8+7Solj6q2mzD8YasiNAITMfbRa4wKsg/chekeMpnns="}, "canopennode": {"name": "canopennode", "owner": "zephyrproject-rtos", "repo": "canopennode", "rev": "dec12fa3f0d790cafa8414a4c2930ea71ab72ffd", "sha256": "sha256-BbmEjeMzKznRDx329PIkmPMCGI+du6wiOj+3X7Ap1HQ="}, "cmsis": {"name": "cmsis", "owner": "zephyrproject-rtos", "repo": "cmsis", "rev": "5a00331455dd74e31e80efa383a489faea0590e3", "sha256": "sha256-1oCeT681nFDbCyhp0mErktuoj3YtFDzP5dLYdWz0+AM="}, "cmsis-dsp": {"name": "cmsis-dsp", "owner": "zephyrproject-rtos", "repo": "cmsis-dsp", "rev": "ff7b5fd1ea5f094665c090c343ec44e74dc0b193", "sha256": "sha256-UWVpcv8yiF5pIohMkJpCE+oE23/j6Te+LgNWB8ayn3k="}, "cmsis-nn": {"name": "cmsis-nn", "owner": "zephyrproject-rtos", "repo": "cmsis-nn", "rev": "0c8669d81381ccf3b1a01d699f3b68b50134a99f", "sha256": "sha256-/2g8h52HxzOLonXgCTXpN/JUY/LOeGMW6llC+un01K4="}, "edtt": {"name": "edtt", "owner": "zephyrproject-rtos", "repo": "edtt", "rev": "64e5105ad82390164fb73fc654be3f73a608209a", "sha256": "sha256-AK4zYIHn0XnkKDl9YGo1lV/2Ea6wLw0rJbzpMA8JZ9w="}, "fatfs": {"name": "fatfs", "owner": "zephyrproject-rtos", "repo": "fatfs", "rev": "427159bf95ea49b7680facffaa29ad506b42709b", "sha256": "sha256-5l3hJazG8BoLZ0QxfSFc98uKArIGAFD1P8D6tsKMRt4="}, "hal_altera": {"name": "hal_altera", "owner": "zephyrproject-rtos", "repo": "hal_altera", "rev": "0d225ddd314379b32355a00fb669eacf911e750d", "sha256": "sha256-H2C+3ASsC5O/mA+O5EJqfoJgx0BhSN0W3OhWNHVQxRU="}, "hal_ambiq": {"name": "hal_ambiq", "owner": "zephyrproject-rtos", "repo": "hal_ambiq", "rev": "0a7c99325aa73a1ef777501da91c2c6608661e56", "sha256": "sha256-5EjZmByUm3Ypc2SjdWk796aaoRkrSHE9Y4Gda8jZPeg="}, "hal_atmel": {"name": "hal_atmel", "owner": "zephyrproject-rtos", "repo": "hal_atmel", "rev": "5ab43007eda3f380c125f957f03638d2e8d1144d", "sha256": "sha256-MjnqUHXrOGT6FEEV4wFqWFTuz3HEthAecSq7dy3IVjM="}, "hal_espressif": {"name": "hal_espressif", "owner": "zephyrproject-rtos", "repo": "hal_espressif", "rev": "31fc5758f3507f8f0af00b1dea1a0df7af99bfc0", "sha256": "sha256-6VuOM1lKtFPiAGbDBXbEy8/UByjSLtfDPsDbf7OHZBU="}, "hal_ethos_u": {"name": "hal_ethos_u", "owner": "zephyrproject-rtos", "repo": "hal_ethos_u", "rev": "90ada2ea5681b2a2722a10d2898eac34c2510791", "sha256": "sha256-w4+/RNRFMgXG/hHzwj9ogW1Urqb14UPNmGajCLsh24o="}, "hal_gigadevice": {"name": "hal_gigadevice", "owner": "zephyrproject-rtos", "repo": "hal_gigadevice", "rev": "2994b7dde8b0b0fa9b9c0ccb13474b6a486cddc3", "sha256": "sha256-Cgcc+7tJy0ryQG4ynrlv7OmNe3OW2kMx1mStGROgA5o="}, "hal_infineon": {"name": "hal_infineon", "owner": "zephyrproject-rtos", "repo": "hal_infineon", "rev": "815e84a5150f95627201f192779a0180d5052de7", "sha256": "sha256-2bWLWJPqZrClWrYGTWCXAHZk0OoctflqnVXCAmL/KUA="}, "hal_intel": {"name": "hal_intel", "owner": "zephyrproject-rtos", "repo": "hal_intel", "rev": "b3b43d4e3da7ba483611bbbea7ef8af92c69df31", "sha256": "sha256-Ys1dAKZjhdBNg/0/UD+6Qj0ayFboxu8yQDdGofgGTdQ="}, "hal_microchip": {"name": "hal_microchip", "owner": "zephyrproject-rtos", "repo": "hal_microchip", "rev": "5d079f1683a00b801373bbbbf5d181d4e33b30d5", "sha256": "sha256-CJdNHsowN9WsKSHekypUdeJvOJ19/0PHZU874CXVaoU="}, "hal_nordic": {"name": "hal_nordic", "owner": "zephyrproject-rtos", "repo": "hal_nordic", "rev": "d054a315eb888ba70e09e5f6decd4097b0276d1f", "sha256": "sha256-0rSZyKvK0iE4qPtPlRfF0IPndi/lLfJk4WJRbwLx9no="}, "hal_nuvoton": {"name": "hal_nuvoton", "owner": "zephyrproject-rtos", "repo": "hal_nuvoton", "rev": "3e0a4c4d3328b2f72b164219add19d5308b53cb5", "sha256": "sha256-TwTOA0tRt2Qz46DQEKeLCuD/Ue5nudxW/R80wEhmgfU="}, "hal_nxp": {"name": "hal_nxp", "owner": "zephyrproject-rtos", "repo": "hal_nxp", "rev": "ad142f5612d927e29b1f9606e8edade871b8a526", "sha256": "sha256-3VnfUMEI3K4isyPObndDw9qTaG1+cqhG029Way2J4J8="}, "hal_openisa": {"name": "hal_openisa", "owner": "zephyrproject-rtos", "repo": "hal_openisa", "rev": "d1e61c0c654d8ca9e73d27fca3a7eb3b7881cb6a", "sha256": "sha256-SR0LvwLu4gzK1T/YoAEj/Uvjrbmj1FzRxOFbjSZ4n44="}, "hal_quicklogic": {"name": "hal_quicklogic", "owner": "zephyrproject-rtos", "repo": "hal_quicklogic", "rev": "b3a66fe6d04d87fd1533a5c8de51d0599fcd08d0", "sha256": "sha256-XpPROaiZN0KRxQCtEOYaXSEBtxAo+atnH1ytOMXpYUI="}, "hal_renesas": {"name": "hal_renesas", "owner": "zephyrproject-rtos", "repo": "hal_renesas", "rev": "a6cf2af9140e014fbbc48d2b6deb802231dd369f", "sha256": "sha256-3/hEJxE+ScUgBeZ9Z9QdE53075xaths4XcmK80OrDQA="}, "hal_rpi_pico": {"name": "hal_rpi_pico", "owner": "zephyrproject-rtos", "repo": "hal_rpi_pico", "rev": "fba7162cc7bee06d0149622bbcaac4e41062d368", "sha256": "sha256-oJQPq//mAxAQW8QzxixbiHJsMMANtQl3BevMUL9Kv5g="}, "hal_silabs": {"name": "hal_silabs", "owner": "zephyrproject-rtos", "repo": "hal_silabs", "rev": "d191d981c4eb20c0c7445a4061fcdbcfa686113a", "sha256": "sha256-XNZJTmPzD45xBBjL8P7CyEd2EWCmjD9hhZ1UtHvjRps="}, "hal_st": {"name": "hal_st", "owner": "zephyrproject-rtos", "repo": "hal_st", "rev": "fb8e79d1a261fd02aadff7c142729f1954163cf3", "sha256": "sha256-MoZ9KE6a5prhJ2JNSuMxB7FO1fqUyagGZC3iRx/ienQ="}, "hal_stm32": {"name": "hal_stm32", "owner": "zephyrproject-rtos", "repo": "hal_stm32", "rev": "89ef0a3383edebf661073073bcdf6e2836fe90ee", "sha256": "sha256-+1YMc+gSShb4SY5vXUQefsz4IKBTxC2tGizZHF4v+Hw="}, "hal_telink": {"name": "hal_telink", "owner": "zephyrproject-rtos", "repo": "hal_telink", "rev": "38573af589173259801ae6c2b34b7d4c9e626746", "sha256": "sha256-ioHMx0rpbRppxAoT5yLcIHgLhoO9vyuas9YwaOEyvtQ="}, "hal_ti": {"name": "hal_ti", "owner": "zephyrproject-rtos", "repo": "hal_ti", "rev": "b85f86e51fc4d47c4c383d320d64d52d4d371ae4", "sha256": "sha256-NaXcMhV3GG+BexuQx3S4vtEchLgKasMlo1NJ+V56JBk="}, "hal_wurthelektronik": {"name": "hal_wurthelektronik", "owner": "zephyrproject-rtos", "repo": "hal_wurthelektronik", "rev": "24ca9873c3d608fad1fea0431836bc8f144c132e", "sha256": "sha256-CIoXgrW/G62hFSSj1q+tnlf5AdzEGnJtQQ2fBYgcS2g="}, "hal_xtensa": {"name": "hal_xtensa", "owner": "zephyrproject-rtos", "repo": "hal_xtensa", "rev": "e6da34fc07dfe96161ab8743f5dbeb6e6307ab93", "sha256": "sha256-UgvBGGGtUGu6pAz+PmF4x7ntH6CQ5Pc573udyX1CeVc="}, "libmetal": {"name": "libmetal", "owner": "zephyrproject-rtos", "repo": "libmetal", "rev": "b91611a6f47dd29fb24c46e5621e797557f80ec6", "sha256": "sha256-n0mZzV62tZI27Y6dftMPWAtMaJQDuB9ju9THrr55QF4="}, "liblc3": {"name": "liblc3", "owner": "zephyrproject-rtos", "repo": "liblc3", "rev": "448f3de31f49a838988a162ef1e23a89ddf2d2ed", "sha256": "sha256-t0dFjIwOGKK5yBn1Y0XFl5jPxviAnER1wLoAH+YQKR8="}, "littlefs": {"name": "littlefs", "owner": "zephyrproject-rtos", "repo": "littlefs", "rev": "ca583fd297ceb48bced3c2548600dc615d67af24", "sha256": "sha256-tj03GWzq3WFr+HPs/27ijoTBxascC69WDzLYcm2Wt4M="}, "loramac-node": {"name": "loramac-node", "owner": "zephyrproject-rtos", "repo": "loramac-node", "rev": "842413c5fb98707eb5f26e619e8e792453877897", "sha256": "sha256-nRtKMPVoSMgjXrIiFEGiwA5o0WvoB/iwBA0goQUmFK0="}, "lvgl": {"name": "lvgl", "owner": "zephyrproject-rtos", "repo": "lvgl", "rev": "8a6a2d1d29d17d1e4bdc94c243c146a39d635fdd", "sha256": "sha256-RDirbdNZ0QQ1g0WJyWx2k70J+zUhTdWiF484VAakVWc="}, "mbedtls": {"name": "mbedtls", "owner": "zephyrproject-rtos", "repo": "mbedtls", "rev": "c38dc78d9a8dcbe43b898cc1171ab33ba3e6fc26", "sha256": "sha256-Jy5eBBdVPrpyRIKV5fUp71cQeijc+XW9ReNLDryvwRg="}, "mcuboot": {"name": "mcuboot", "owner": "zephyrproject-rtos", "repo": "mcuboot", "rev": "13767d0b72eb14ce42eb8aad1e5a133ef66afc54", "sha256": "sha256-0M3O2KnzwLUfwdb6saontW1jlyjSu4dI625Dj/xtQH4="}, "mipi-sys-t": {"name": "mipi-sys-t", "owner": "zephyrproject-rtos", "repo": "mipi-sys-t", "rev": "a819419603a2dfcb47f7f39092e1bc112e45d1ef", "sha256": "sha256-IVOOcEJZx/jzTGfm+1WJatzYsw5+URzSeIxq92bjm2w="}, "net-tools": {"name": "net-tools", "owner": "zephyrproject-rtos", "repo": "net-tools", "rev": "d68ee9d17648a1bb3729c2023abfcb735dfe92fa", "sha256": "sha256-hm39nDusf04Ry8eo91YiNHDQtQKtiBtNiXBYwT7fmdQ="}, "nrf_hw_models": {"name": "nrf_hw_models", "owner": "zephyrproject-rtos", "repo": "nrf_hw_models", "rev": "f4595802d32d103718bf50b3d390b7a450895843", "sha256": "sha256-5SIlP6gyZroNyN43TwfhEGeKfwgP/AYbwBuNnb2z5hI="}, "open-amp": {"name": "open-amp", "owner": "zephyrproject-rtos", "repo": "open-amp", "rev": "42b7c577714b8f22ce82a901e19c1814af4609a8", "sha256": "sha256-iZtC8uXGapFPNU2XNWjfc6DmuaqkUiZo6H/swciOATI="}, "openthread": {"name": "openthread", "owner": "zephyrproject-rtos", "repo": "openthread", "rev": "d62167ee34b091e7025c9ec2820aae71e17a3944", "sha256": "sha256-2TWMFYHTFk30d9PikK4kLnFWIjSkYTDQgpasD8mlQ1k="}, "percepio": {"name": "percepio", "owner": "zephyrproject-rtos", "repo": "percepio", "rev": "a3728efccc47dd372f40e6313589ca4c5cc7d5e9", "sha256": "sha256-/BHYjJrBSdSA8KFU1DwgOX9PbLe+8ltuOvpEq7k0Hzo="}, "picolibc": {"name": "picolibc", "owner": "zephyrproject-rtos", "repo": "picolibc", "rev": "d07c38ff051386f8e09a143ea0a6c1d6d66dd1d8", "sha256": "sha256-+P7jCnRPumDzk1Fw8qvRV6W+reoIM+8lrjWs6Hm8ZN0="}, "segger": {"name": "segger", "owner": "zephyrproject-rtos", "repo": "segger", "rev": "9d0191285956cef43daf411edc2f1a7788346def", "sha256": "sha256-9nt0z674ubxxvIANPMf82Qf7KsOwR3Hg8wYAK5r/i4c="}, "tinycrypt": {"name": "tinycrypt", "owner": "zephyrproject-rtos", "repo": "tinycrypt", "rev": "3e9a49d2672ec01435ffbf0d788db6d95ef28de0", "sha256": "sha256-5gtZbZNx+D/EUkyYk7rPtcxBZaNs4IFGTP/7IXzCoqU="}, "trusted-firmware-m": {"name": "trusted-firmware-m", "owner": "zephyrproject-rtos", "repo": "trusted-firmware-m", "rev": "b168d92c7ed3c77c94d7ce3362bdde5dbffe8424", "sha256": "sha256-WFQ/aOD+tFClMSNYUAjmc0tp3jyUxmKwk8AOZ6kUBsw="}, "trusted-firmware-a": {"name": "trusted-firmware-a", "owner": "zephyrproject-rtos", "repo": "trusted-firmware-a", "rev": "421dc050278287839f5c70019bd6aec617f2bbdb", "sha256": "sha256-XsjRUe0Cr5bd+rOzoS+Hquh9k2nKwDKt2+up24aCOgk="}, "uoscore-uedhoc": {"name": "uoscore-uedhoc", "owner": "zephyrproject-rtos", "repo": "uoscore-uedhoc", "rev": "5fe2cb613bd7e4590bd1b00c2adf181ac0229379", "sha256": "sha256-Ag/pFDX5SCirxhO8ducHs1I/yXdq1tsj20EN16LrH0A="}, "zcbor": {"name": "zcbor", "owner": "zephyrproject-rtos", "repo": "zcbor", "rev": "67fd8bb88d3136738661fa8bb5f9989103f4599e", "sha256": "sha256-Z4I14nLsER+GcqGzd8ILuk9QBUOV3u3aMA4q2s9EI5g="}}} \ No newline at end of file diff --git a/packages/zephyr/update.py b/packages/zephyr/update-sdk.py similarity index 100% rename from packages/zephyr/update.py rename to packages/zephyr/update-sdk.py diff --git a/packages/zephyr/update-src.py b/packages/zephyr/update-src.py new file mode 100755 index 0000000..5117c87 --- /dev/null +++ b/packages/zephyr/update-src.py @@ -0,0 +1,72 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i python3 -p python3 python3Packages.requests python3Packages.pyyaml nix-prefetch +import requests +import json +import yaml +import subprocess +import os + +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def get_repo(owner, repo, rev, name): + out = subprocess.run( + [ + "nix-prefetch", + "--output", + "json", + "fetchFromGitHub", + "--owner", + owner, + "--repo", + repo, + "--rev", + rev, + "--name", + repo, + ], + stdout=subprocess.PIPE, + check=True, + ) + return json.loads(out.stdout.decode("utf-8")) + + +release = requests.get( + "https://api.github.com/repos/zephyrproject-rtos/zephyr/releases/latest" +).json() +tag = release["tag_name"] +version = tag[1:] + +# nix-prefetch won't save the source so we download the manifest separately +manifest = yaml.load( + requests.get( + f"https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/{tag}/west.yml" + ).text, + Loader=yaml.Loader, +)["manifest"] + +zephyr = get_repo("zephyrproject-rtos", "zephyr", tag, "zephyr") + +default_remote = manifest["defaults"]["remote"] + +remotes = {} +for remote in manifest["remotes"]: + # Works for github URLs, which is all they use + remotes[remote["name"]] = remote["url-base"].removeprefix("https://github.com/") + +modules = {} +for project in manifest["projects"]: + if "repo-path" in project: + repo = project["repo-path"].removesuffix(".git") + else: + repo = project["name"] + owner = remotes[project.get("remote", default_remote)] + + modules[project["name"]] = get_repo( + owner, repo, project["revision"], project["name"] + ) + +out_obj = {"version": version, "zephyr": zephyr, "modules": modules} + +with open(os.path.join(BASE_DIR, "modules.json"), "w") as out_file: + json.dump(out_obj, out_file)