update script

This commit is contained in:
mjallen18
2025-03-23 13:07:05 -05:00
parent 094bca46d7
commit 0561e80635

View File

@@ -1,6 +1,25 @@
{ lib, pkgs, ... }:
let
timezone = "America/Chicago";
update-script = pkgs.writeScriptBin "update-system" ''
#!/usr/bin/env bash
cd /etc/nixos
# Get commit message and timestamp for the tag
COMMIT_MSG=$(git log -1 --pretty=%B | head -n1 | tr -dc '[:alnum:][:space:]-' | tr '[:space:]' '-')
TIMESTAMP=$(date +%Y%m%d-%H%M)
SHORT_HASH=$(git rev-parse --short HEAD)
# Create a profile name using the timestamp, short hash, and commit message
PROFILE_NAME="$TIMESTAMP-$SHORT_HASH-$COMMIT_MSG"
# Rebuild the system
sudo nixos-rebuild boot --profile-name "$PROFILE_NAME"
echo "System rebuilt with profile: $PROFILE_NAME"
'';
in
{
imports = [
@@ -108,6 +127,7 @@ in
};
environment.systemPackages = with pkgs; [
update-script
nixd
pinentry-curses
];