boot/gui: Allow running without generations file
This should *maybe* remove the Generations tab, as it's empty.
@@ -10,6 +10,9 @@ REFRESH_RATE = 120
NIXOS_LIGHT_HUE = 205
NIXOS_DARK_HUE = 220
+# File with boot selection
+SELECTIONS = "/run/boot/selection.json"
+
# Define the arguments
Args.define({
resolution: nil,
@@ -281,7 +284,8 @@ end
# Generations tab
-JSON.parse(File.read("/run/boot/selection.json")).each do |selection|
+if File.exist?(SELECTIONS)
+ JSON.parse(File.read(SELECTIONS)).each do |selection|
ui.button(selection["name"], page: :generations).tap do |btn|
btn.event_handler = ->(event) do
case event
@@ -292,6 +296,7 @@ JSON.parse(File.read("/run/boot/selection.json")).each do |selection|
end
end
end
+end
# Main loop
while true
