DistroHopper/templates/nixos
2026-11-17 18:32:48 +01:00

61 lines
1.7 KiB
Text

# Template file for 'nixos'
OSNAME="nixos"
PRETTY="NixOS"
LOGO=" "
ICON="nixos.svg"
CATEGORY="advanced"
BASEDOF="-"
HOMEPAGE="https://nixos.org"
DESCRIPTION="Linux distribution based on Nix package manager, tool that takes a unique approach to package management and system configuration"
CREDENTIALS="-"
GPG=""
RSS=""
DW=""
function 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)
}
function 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
}
function 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}"
}
function config_() {
echo "disk_size=\"32G\"" >> "${CONF_FILE}"
}