Regenerated

This commit is contained in:
2026-04-29 12:06:37 +02:00
parent 3fd2ec4132
commit 652dbf831f
4 changed files with 531 additions and 702 deletions
@@ -1,90 +1,51 @@
// --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
import Quickshell
import Quickshell.Io
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
Window {
id: root
width: 600
height: 380
width: 500
height: 200
visible: true
title: "System Updater"
property int currentStep: 0
property int totalSteps: 4
property string status: "idle"
property int progress: 0
property string status: "Waiting..."
Timer {
interval: 300
running: true
repeat: true
onTriggered: {
let file = "/tmp/nixos-updater-status"
let xhr = new XMLHttpRequest()
xhr.open("GET", "file://" + file)
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
let parts = xhr.responseText.trim().split("|")
if (parts.length === 2) {
progress = parseInt(parts[0])
status = parts[1]
}
}
}
xhr.send()
}
}
Column {
anchors.fill: parent
anchors.margins: 16
anchors.centerIn: parent
spacing: 10
Text {
text: "System Updater"
font.pixelSize: 20
}
Text { text: status }
ProgressBar {
from: 0
to: root.totalSteps
value: root.currentStep
width: parent.width
}
Text {
text: "Step " + root.currentStep + " / " + root.totalSteps
}
Rectangle {
width: parent.width
height: 180
ListView {
id: logView
anchors.fill: parent
model: logModel
}
ListModel {
id: logModel
}
}
Row {
spacing: 10
Button {
text: "Run update"
onClicked: updater.start()
}
Button {
text: "Close"
onClicked: root.visible = false
}
}
}
Process {
id: updater
command: ["bash", "/home/henrov/.config/scripts/update-engine.sh"]
onOutput: function(data) {
logModel.append({ text: data.trim() })
if (data.startsWith("STEP:")) {
let parts = data.split(":")
root.currentStep = parseInt(parts[1])
}
if (data.startsWith("DONE")) {
root.status = "done"
}
if (data.startsWith("FAIL")) {
root.status = "error"
}
to: 100
value: progress
width: 300
}
}
}
@@ -1,42 +1,24 @@
#!/usr/bin/env bash
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
set -uo pipefail
emit() { echo "$1"; }
STATUS_FILE="/tmp/nixos-updater-status"
step() {
echo "STEP:$1:$2"
echo "0|Starting" > "$STATUS_FILE"
update_step() {
echo "$1|$2" > "$STATUS_FILE"
}
ok() {
echo "OK:$1"
}
update_step 10 "Fixing ownership"
sudo chown -R "$USER":"wheel" "$REPO"
fail() {
echo "FAIL:$1"
}
update_step 30 "Updating flake"
nix flake update
REPO="/home/$USER/Repos/nixos/Droidnix"
HOSTNAME="$(hostname)"
cd "$REPO" || exit 1
update_step 60 "Rebuilding system"
sudo nixos-rebuild switch --flake ".#$HOSTNAME"
step 1 "Fixing ownership"
sudo chown -R "$USER":"wheel" "$REPO" || fail "ownership"
ok 1
update_step 90 "Updating Flatpaks"
flatpak update -y
step 2 "Updating flake"
nix flake update || fail "flake"
ok 2
step 3 "Rebuilding system"
sudo nixos-rebuild switch --flake ".#$HOSTNAME" || fail "rebuild"
hyprctl reload
ok 3
step 4 "Flatpak cleanup"
flatpak uninstall --unused -y
flatpak update --appstream -y
flatpak update -y || fail "flatpak"
ok 4
emit "DONE"
update_step 100 "Done"