update script
This commit is contained in:
@@ -1,6 +1,25 @@
|
|||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
timezone = "America/Chicago";
|
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
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -108,6 +127,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
update-script
|
||||||
nixd
|
nixd
|
||||||
pinentry-curses
|
pinentry-curses
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user