# Template file for 'nixos' OSNAME="nixos" PRETTY="NixOS" LOGO=" " ICON="nixos.svg" ICON_ONLINE="" CATEGORY="advanced" BASEDOF="-" DESCRIPTION="Linux distribution based on Nix package manager, tool that takes a unique approach to package management and system configuration" HOMEPAGE="https://nixos.org" CREDENTIALS="-" GPG="" RSS="" DW="" MAGNET="" MAGNET_PREFERRED="" TORRENT="" CHAT="" RELEASES="26.05 25.05 unstable" EDITIONS="minimal" EDITIONS_LIST="minimal" QEMU_ARCH="amd64" releases_() { # Lists unstable plus the two most recent releases #shellcheck disable=SC2046 echo unstable $(web_pipe "https://nix-channels.s3.amazonaws.com/?delimiter=/" | grep -o -E 'nixos-[[:digit:]]+\.[[:digit:]]+' | cut -d- -f2 | sort -nru | head -n +2) } editions_() { local SELECTED_RELEASE="${RELEASE:-}" if [ -z "${SELECTED_RELEASE}" ]; then echo minimal plasma gnome return fi local URL="https://channels.nixos.org/nixos-${SELECTED_RELEASE}" local EDITION_NAME="" local ISO="" for EDITION_NAME in minimal plasma gnome; do ISO="latest-nixos-${EDITION_NAME}-x86_64-linux.iso" if [ "${EDITION_NAME}" == "plasma" ] && [ "${SELECTED_RELEASE}" != "23.11" ]; then ISO="latest-nixos-plasma6-x86_64-linux.iso" elif [ "${EDITION_NAME}" == "plasma" ]; then ISO="latest-nixos-plasma5-x86_64-linux.iso" fi web_check "${URL}/${ISO}" && echo "${EDITION_NAME}" done } get_() { local HASH="" # Adapt the plasma edition according to the NixOS release case "${EDITION}" in plasma) if [ "${RELEASE}" == "23.11" ]; then EDITION+="5" else EDITION+="6" fi ;; esac local ISO="latest-nixos-${EDITION}-x86_64-linux.iso" local URL="https://channels.nixos.org/nixos-${RELEASE}" HASH=$(web_pipe "${URL}/${ISO}.sha256" | grep -oE '^[[:xdigit:]]{64}' | head -n 1) echo "${URL}/${ISO} ${HASH}" } config_() { echo "disk_size=\"32G\"" >> "${CONF_FILE}" } releases_() { # Releases parsed at generation time — no network access needed. echo "${RELEASES}" } editions_() { # Editions parsed at generation time — no network access needed. local _scoped="" if [ -n "${RELEASE:-}" ] && declare -F _release_editions_ >/dev/null; then _scoped=$(_release_editions_ "${ARCH:-}|${RELEASE}") fi if [ -n "${_scoped}" ]; then echo "${_scoped}" return 0 fi local _per_arch="EDITIONS_${ARCH:-}" if [ -n "${!_per_arch:-}" ]; then echo "${!_per_arch}" return 0 fi echo "${EDITIONS:-}" }