diff --git a/hosts/default.nix b/hosts/default.nix index d1c1a4d..8c8704d 100755 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -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 ];