Compare commits

44 Commits

Author SHA1 Message Date
Gitea Actions
bc405d562b Update flake.lock 2025-04-28 2025-07-13 00:30:45 +00:00
Gitea Actions
ceea87ad5b Update flake.lock 2025-04-27 2025-07-13 00:30:45 +00:00
Gitea Actions
851c8c797d Update flake.lock 2025-04-26 2025-07-13 00:30:45 +00:00
Gitea Actions
f542f84b38 Update flake.lock 2025-04-25 2025-07-13 00:30:45 +00:00
Gitea Actions
ed5b4cbd14 Update flake.lock 2025-04-24 2025-07-13 00:30:45 +00:00
Gitea Actions
761015b478 Update flake.lock 2025-04-23 2025-07-13 00:30:45 +00:00
Gitea Actions
20eaa0dae3 Update flake.lock 2025-04-22 2025-07-13 00:30:45 +00:00
Gitea Actions
f5dd2ecc82 Update flake.lock 2025-04-21 2025-07-13 00:30:45 +00:00
Gitea Actions
f9b71edc81 Update flake.lock 2025-04-20 2025-07-13 00:30:45 +00:00
Gitea Actions
7719c812bd Update flake.lock 2025-04-19 2025-07-13 00:30:45 +00:00
Gitea Actions
3c027501c5 Update flake.lock 2025-04-18 2025-07-13 00:30:45 +00:00
Gitea Actions
d65b916d40 Update flake.lock 2025-04-17 2025-07-13 00:30:45 +00:00
Gitea Actions
a1cde5ef34 Update flake.lock 2025-04-16 2025-07-13 00:30:45 +00:00
Gitea Actions
686906cf77 Update flake.lock 2025-04-15 2025-07-13 00:30:45 +00:00
Gitea Actions
37f986cefc Update flake.lock 2025-04-14 2025-07-13 00:30:45 +00:00
Gitea Actions
1dcef60e92 Update flake.lock 2025-04-13 2025-07-13 00:30:45 +00:00
Gitea Actions
5970fcabc8 Update flake.lock 2025-04-12 2025-07-13 00:30:45 +00:00
Gitea Actions
766d18ad52 Update flake.lock 2025-04-11 2025-07-13 00:30:45 +00:00
Gitea Actions
47c02828e3 Update flake.lock 2025-04-10 2025-07-13 00:30:45 +00:00
Gitea Actions
5fff601b29 Update flake.lock 2025-04-09 2025-07-13 00:30:45 +00:00
Gitea Actions
04236cf485 Update flake.lock 2025-04-08 2025-07-13 00:30:45 +00:00
Gitea Actions
fcf95d1430 Update flake.lock 2025-04-07 2025-07-13 00:30:45 +00:00
Gitea Actions
12798ff1a1 Update flake.lock 2025-04-06 2025-07-13 00:30:45 +00:00
Gitea Actions
01572c6f3d Update flake.lock 2025-04-05 2025-07-13 00:30:45 +00:00
Gitea Actions
cde1265492 Update flake.lock 2025-04-04 2025-07-13 00:30:45 +00:00
Gitea Actions
225743b432 Update flake.lock 2025-04-03 2025-07-13 00:30:45 +00:00
Gitea Actions
ac5a7b1954 Update flake.lock 2025-04-02 2025-07-13 00:30:45 +00:00
Gitea Actions
b1ba5f6dfc Update flake.lock 2025-04-01 2025-07-13 00:30:45 +00:00
Gitea Actions
c36161b19e Update flake.lock 2025-03-31 2025-07-13 00:30:45 +00:00
Gitea Actions
593cb43662 Update flake.lock 2025-03-30 2025-07-13 00:30:45 +00:00
Gitea Actions
a9045fe86a Update flake.lock 2025-03-29 2025-07-13 00:30:45 +00:00
Gitea Actions
b001afa40d Update flake.lock 2025-03-28 2025-07-13 00:30:45 +00:00
Gitea Actions
d54beba986 Update flake.lock 2025-03-27 2025-07-13 00:30:45 +00:00
Gitea Actions
784fdf8af1 Update flake.lock 2025-03-26 2025-07-13 00:30:45 +00:00
Gitea Actions
536120fadc Update flake.lock 2025-03-25 2025-07-13 00:30:45 +00:00
Gitea Actions
ac47c73bf1 Update flake.lock 2025-03-24 2025-07-13 00:30:45 +00:00
Gitea Actions
2d1109d012 Update flake.lock 2025-03-23 2025-07-13 00:30:45 +00:00
c543bc13ea hm: disable warn-dirty
Some checks failed
Update Nix Flake / update-flake (push) Failing after 18s
2025-07-12 15:52:17 +02:00
b4d1681b99 hyprland: fix waybar by running it with exec-once 2025-07-12 15:51:43 +02:00
6c32ffbe94 frajul-auto-upgrade: only run once a day
Some checks failed
Update Nix Flake / update-flake (push) Failing after 14s
2025-07-11 16:22:17 +02:00
6787243414 flake: update 2025-07-11 13:15:42 +02:00
d350807e8c builder: do enable auto-upgrades 2025-07-11 13:15:25 +02:00
f872c8db0c aspi: enable frajul auto upgrade module and integrate into waybar 2025-07-11 13:15:02 +02:00
8c53c66c4d Add frajul-auto-upgrade module 2025-07-11 13:14:48 +02:00
9 changed files with 960 additions and 69 deletions

842
flake.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -162,7 +162,10 @@ in {
monitor = ",preferred,auto,1";
# Autostart
exec-once = ["firefox"];
exec-once = [
(lib.getExe pkgs.firefox)
(lib.getExe pkgs.waybar)
];
# Look and Feel
general = {

View File

@@ -12,7 +12,14 @@
"modules-center": [],
"modules-right": ["idle_inhibitor", "disk", "cpu", "memory", "pulseaudio", "battery", "clock", "tray"],
"modules-right": ["idle_inhibitor", "custom/nixos-update", "disk", "cpu", "memory", "pulseaudio", "battery", "clock", "tray"],
"custom/nixos-update": {
"exec": "frajul-auto-upgrade-status",
"return-type": "json",
"interval": 2,
"on-click-right": "frajul-auto-upgrade-toggle"
},
"hyprland/workspaces": {
"on-scroll-up": "hyprctl dispatch workspace m+1",
@@ -35,6 +42,7 @@
},
"idle_inhibitor": {
"start-activated": true,
"format": "{icon}",
"format-icons": {
"activated": "",

View File

@@ -10,7 +10,7 @@
in {
programs.waybar = {
enable = true;
systemd.enable = true;
# systemd.enable = true;
settings.mainBar = builtins.fromJSON (builtins.readFile ./config.json);
};

View File

@@ -20,7 +20,7 @@
"flakes"
"ca-derivations"
];
# warn-dirty = false; # TODO: do I want it? also for systems
warn-dirty = false; # TODO: do I want it? also for systems
};
};

View File

@@ -32,6 +32,10 @@
enable = true;
overrideSettings = false;
};
frajulAutoUpgrade = {
enable = true;
flakePath = "/home/julian/.dotfiles";
};
};
services.blueman.enable = true;

View File

@@ -43,6 +43,15 @@
cores = 0;
};
system.autoUpgrade = {
enable = true;
flake = "git+https://gitlab.julian-mutter.de/julian/dotfiles";
flags = [
"--recreate-lock-file" # update lock file
];
dates = "02:13";
};
# optimize store by hardlinking store files
nix.optimise.automatic = true;
nix.optimise.dates = ["03:15"];

View File

@@ -1,4 +1,5 @@
{
# hydra-auto-upgrade = import ./hydra-auto-upgrade.nix;
syncthing = import ./syncthing.nix;
frajulAutoUpgrade = import ./frajul-auto-upgrade.nix;
}

View File

@@ -0,0 +1,154 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.modules.frajulAutoUpgrade;
flagFile = "/var/lib/frajul-auto-upgrade/flag";
lockFile = "/var/lib/frajul-auto-upgrade/lock";
lastStatusFile = "/var/lib/frajul-auto-upgrade/last-status";
lastAttemptFile = "/var/lib/frajul-auto-upgrade/last-attempt";
in {
options.modules.frajulAutoUpgrade = {
enable = lib.mkEnableOption "NixOS auto-upgrade on boot";
user = lib.mkOption {
type = lib.types.str;
default = "root";
description = "User account to run the upgrade service as.";
};
flakePath = lib.mkOption {
type = lib.types.path;
description = "The path to your flake";
};
};
config = lib.mkIf cfg.enable {
# Ensure the flag directory exists
systemd.tmpfiles.rules = [
"d /var/lib/frajul-auto-upgrade 0755 root root -"
"f ${flagFile} 0766 root root -"
"f ${lastStatusFile} 0644 root root -"
"f ${lastAttemptFile} 0644 root root -"
];
environment.systemPackages = [
(pkgs.writeShellScriptBin "frajul-auto-upgrade" ''
#!/bin/sh
FLAG_FILE="${flagFile}"
LOCK_FILE="${lockFile}"
LAST_STATUS_FILE="${lastStatusFile}"
LAST_ATTEMPT_FILE="${lastAttemptFile}"
TODAY=$(date +%Y-%m-%d)
if [ ! -f "$FLAG_FILE" ] || [ "$(cat "$FLAG_FILE")" != "enabled" ]; then
echo "Auto upgrade disabled. Exiting."
exit 0
fi
# Check if already attempted today
if [ -f "$LAST_ATTEMPT_FILE" ]; then
LAST_ATTEMPT_DATE=$(cut -d' ' -f1 "$LAST_ATTEMPT_FILE")
if [ "$LAST_ATTEMPT_DATE" = "$TODAY" ]; then
echo "Update already attempted today. Skipping."
exit 0
fi
fi
if [ -f "$LOCK_FILE" ]; then
echo "Already running"
exit 1
fi
echo $$ > "$LOCK_FILE"
trap 'rm -f "$LOCK_FILE"' EXIT
if nix flake update --flake "${cfg.flakePath}" && nixos-rebuild switch --flake "${cfg.flakePath}"; then
echo "success" > "$LAST_STATUS_FILE"
else
echo "failure" > "$LAST_STATUS_FILE"
fi
# Write full timestamp
date '+%Y-%m-%d %H:%M:%S' > "$LAST_ATTEMPT_FILE"
'')
(pkgs.writeShellScriptBin "frajul-auto-upgrade-status" ''
#!/bin/sh
FLAG_FILE="${flagFile}"
LOCK_FILE="${lockFile}"
LAST_STATUS_FILE="${lastStatusFile}"
LAST_ATTEMPT_FILE="${lastAttemptFile}"
if [ -f "$LOCK_FILE" ]; then
ICON=" "
STATUS="running"
elif [ -f "$FLAG_FILE" ] && [ "$(cat "$FLAG_FILE")" == "enabled" ]; then
LAST_STATUS="unknown"
LAST_ATTEMPT="never"
if [ -f "$LAST_STATUS_FILE" ]; then
LAST_STATUS=$(cat "$LAST_STATUS_FILE")
fi
if [ -f "$LAST_ATTEMPT_FILE" ]; then
LAST_ATTEMPT=$(cat "$LAST_ATTEMPT_FILE")
fi
if [ "$LAST_STATUS" = "success" ]; then
ICON=""
elif [ "$LAST_STATUS" = "failure" ]; then
ICON=""
else
ICON=""
fi
STATUS="enabled (last attempt: $LAST_ATTEMPT, $LAST_STATUS)"
else
ICON=" "
STATUS="disabled"
fi
echo "{\"text\": \"$ICON\", \"tooltip\": \"NixOS Auto Update: $STATUS\"}"
'')
(pkgs.writeShellScriptBin "frajul-auto-upgrade-toggle" ''
#!/bin/sh
FLAG_FILE="${flagFile}"
LOCK_FILE="${lockFile}"
if [ ! -f "$FLAG_FILE" ] || [ "$(cat "$FLAG_FILE")" != "enabled" ]; then
echo "enabled" > "$FLAG_FILE"
else
echo "disabled" > "$FLAG_FILE"
if [ -f "$LOCK_FILE" ]; then
kill -TERM "$(cat "$LOCK_FILE")"
fi
fi
'')
];
systemd.services.frajul-auto-upgrade = {
description = "Frajul's NixOS Auto Upgrade";
after = ["network-online.target"];
restartIfChanged = false; # Do not start service on nixos switch
serviceConfig = {
Type = "oneshot";
User = cfg.user;
ExecStart = "/run/current-system/sw/bin/frajul-auto-upgrade";
};
};
systemd.timers.frajul-auto-upgrade = {
description = "Run Frajul's NixOS Auto Upgrade at boot";
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "1min";
AccuracySec = "10s";
Unit = "frajul-auto-upgrade.service";
};
};
};
}