rebuild script now has a -U flag for updating the flake before rebuilding

This commit is contained in:
2026-02-23 20:55:43 -05:00
parent 2a0116c336
commit ae90dbf4c9
6 changed files with 63 additions and 39 deletions

44
flake.lock generated
View File

@@ -107,11 +107,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1771523612, "lastModified": 1771834427,
"narHash": "sha256-ScRqXJaqDTonQ1cs7VKxPw5pO0TQ/OnErfjOKCHX4Ps=", "narHash": "sha256-B1j0ahVuxyZtpbFfy34gk2DjacimPIuzyzCPvDhvxI4=",
"owner": "9001", "owner": "9001",
"repo": "copyparty", "repo": "copyparty",
"rev": "6f1d6647546832c6640cbad88817e28fb63ea3ec", "rev": "ab8bd0178b26a0b6c6406f7bae835d13b16ef188",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -125,11 +125,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1771469470, "lastModified": 1771881364,
"narHash": "sha256-GnqdqhrguKNN3HtVfl6z+zbV9R9jhHFm3Z8nu7R6ml0=", "narHash": "sha256-A5uE/hMium5of/QGC6JwF5TGoDAfpNtW00T0s9u/PN8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "4707eec8d1d2db5182ea06ed48c820a86a42dc13", "rev": "a4cb7bf73f264d40560ba527f9280469f1f081c6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -144,11 +144,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1771568980, "lastModified": 1771897953,
"narHash": "sha256-/qbVs2dZVibeg9mDfeKIapmJ3glHgCOYxUuOf8pRKcQ=", "narHash": "sha256-43d9HLWOASfHYxG3JSNpMUAFQA114y00VpGRGanPdaM=",
"owner": "km-clay", "owner": "km-clay",
"repo": "fern", "repo": "fern",
"rev": "9b8c8d704b5e1485e15e29d7340cf8a62aa8fb52", "rev": "05f731b8c517fc19d65c8da5977b68fd04cf4346",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -328,11 +328,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1771531206, "lastModified": 1771851181,
"narHash": "sha256-1R3Wx6KUkMb4x4E5UOhW9p6rqiexzSGGWxZqSHqW5n0=", "narHash": "sha256-gFgE6mGUftwseV3DUENMb0k0EiHd739lZexPo5O/sdQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "91be7cce763fa4022c7cf025a71b0c366d1b6e77", "rev": "9a4b494b1aa1b93d8edf167f46dc8e0c0011280c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -434,11 +434,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1771522877, "lastModified": 1771865886,
"narHash": "sha256-dqnkEwXPWuI8MW38kKjs880qaVA+WEWziz5liznzLYA=", "narHash": "sha256-hqoGotv4iNiYmIzQtBQziDANCEQ1L1vtsGODtJGlBgM=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "9ea6d0e15fddccf321c035e83b007a55d6829dd9", "rev": "bc09504ea50901bedf945859bf7bd4c739e1ed38",
"revCount": 6902, "revCount": 6916,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/hyprwm/Hyprland" "url": "https://github.com/hyprwm/Hyprland"
@@ -985,11 +985,11 @@
"systems": "systems_5" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1771268051, "lastModified": 1771737804,
"narHash": "sha256-nGqPcngnezoT+/xAvw3UDjwdKP2MC4fO315A/Otb9eE=", "narHash": "sha256-7wn9qbzIQQgH8tnq4VwzuWEqEWpekuymlLyhY3vM/j8=",
"owner": "gerg-l", "owner": "gerg-l",
"repo": "spicetify-nix", "repo": "spicetify-nix",
"rev": "b930de84c561f62a0c39a6a57c2ab553a97e8495", "rev": "6dd43010ac2458cc56a6ac5250349b9217a7a2ae",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1017,11 +1017,11 @@
"tinted-zed": "tinted-zed" "tinted-zed": "tinted-zed"
}, },
"locked": { "locked": {
"lastModified": 1771541829, "lastModified": 1771787992,
"narHash": "sha256-jtrIUcFoZuS6R4P18907H0pPyHaGoF5Tomez7j3KIHs=", "narHash": "sha256-Vg4bGwwenNYI8p3nJTl9FRyeIyrjATeZrZr+GyUSDrw=",
"owner": "danth", "owner": "danth",
"repo": "stylix", "repo": "stylix",
"rev": "cb73f89d3ecef7e790c42f828e2228ff82975de5", "rev": "30054cca073b49b42a71289edec858f535b27fe9",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -1,11 +1,12 @@
{ lib, config, self, ... }: { lib, config, pkgs, self, ... }:
{ {
programs.fern = { programs.fern = {
aliases = { aliases = {
mv = "mv -v"; mv = "mv -v";
cp = "cp -vr"; cp = "cp -vr";
gt = "gtrash"; gt = "gtrash";
gtp = "playshellsound ${self}/assets/sound/rm.wav"; gtp = "${pkgs.myScripts.playshellsound}/bin/playshellsound ${self}/assets/sound/rm.wav && gtrash put";
diff = "diff --color=auto";
sr = "source ~/.fernrc"; sr = "source ~/.fernrc";
psg = "ps aux | grep -v grep | grep -i -e VSZ -e"; psg = "ps aux | grep -v grep | grep -i -e VSZ -e";
mkdir = "mkdir -p"; mkdir = "mkdir -p";

View File

@@ -13,6 +13,8 @@
FZF_DEFAULT_COMMAND = "fd"; FZF_DEFAULT_COMMAND = "fd";
FZF_DEFAULT_OPTS = "--height 40% --layout=reverse --border"; FZF_DEFAULT_OPTS = "--height 40% --layout=reverse --border";
LESS = "-R"; # pager uses alt buffer
}; };
}; };
} }

View File

@@ -8,13 +8,15 @@ in
programs.fern = { programs.fern = {
settings.extraPreConfig = '' settings.extraPreConfig = ''
prompt_topline() { prompt_topline() {
local last_cmd_status
local last_cmd_runtime
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
last_cmd_status="\e[1;32m\e[0m" last_cmd_status="\e[1;32m\e[0m"
else else
last_cmd_status="\e[1;31m\e[0m" last_cmd_status="\e[1;31m\e[0m"
fi fi
user_and_host="\e[1m$USER\e[1;36m@\e[1;31m$HOST\e[0m" local user_and_host="\e[1m$USER\e[1;36m@\e[1;31m$HOST\e[0m"
last_runtime_raw="$(echo -p "\t")" local last_runtime_raw="$(echo -p "\t")"
if [ -z "$last_runtime_raw" ]; then if [ -z "$last_runtime_raw" ]; then
last_cmd_runtime="" last_cmd_runtime=""
last_cmd_status="" last_cmd_status=""
@@ -27,19 +29,19 @@ in
prompt_midline() { prompt_midline() {
git rev-parse --is-inside-work-tree > /dev/null 2>&1 || return git rev-parse --is-inside-work-tree > /dev/null 2>&1 || return
status="$(git status --porcelain 2>/dev/null)" local gitsigns
gitsigns="" local status="$(git status --porcelain 2>/dev/null)"
[ -n "$status" ] && echo "$status" | command grep -q '^ [MADR]' && gitsigns="$gitsigns!" [ -n "$status" ] && echo "$status" | command grep -q '^ [MADR]' && gitsigns="$gitsigns!"
[ -n "$status" ] && echo "$status" | command grep -q '^??' && gitsigns="$gitsigns?" [ -n "$status" ] && echo "$status" | command grep -q '^??' && gitsigns="$gitsigns?"
[ -n "$status" ] && echo "$status" | command grep -q '^[MADR]' && gitsigns="$gitsigns+" [ -n "$status" ] && echo "$status" | command grep -q '^[MADR]' && gitsigns="$gitsigns+"
ahead="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)" local ahead="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
behind="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)" local behind="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
[ $ahead -gt 0 ] && gitsigns="$gitsigns" [ $ahead -gt 0 ] && gitsigns="$gitsigns"
[ $behind -gt 0 ] && gitsigns="$gitsigns" [ $behind -gt 0 ] && gitsigns="$gitsigns"
branch="$(git branch --show-current 2>/dev/null)" local branch="$(git branch --show-current 2>/dev/null)"
if [ -n "$gitsigns" ] || [ -n "$branch" ]; then if [ -n "$gitsigns" ] || [ -n "$branch" ]; then
if [ -n "$gitsigns" ]; then if [ -n "$gitsigns" ]; then
@@ -54,12 +56,14 @@ in
} }
prompt() { prompt() {
top="$(prompt_topline)" local top="$(prompt_topline)"
mid="$(prompt_midline)" local mid="$(prompt_midline)"
bot="$(prompt_botline)" local bot="$(prompt_botline)"
dollar="$(echo -p "\$ ")" local dollar="$(echo -p "\$ ")"
dollar="$(echo -e "\e[1;32m$dollar\e[0m")" local dollar="$(echo -e "\e[1;32m$dollar\e[0m")"
echo -en "$top$mid$bot\n$dollar" local prompt="$top$mid$bot\n$dollar"
echo -en "$prompt"
} }
export PS1="\n\!prompt " export PS1="\n\!prompt "
@@ -125,7 +129,7 @@ in
fi fi
} }
gitcommit_sfx() { gitcommit_sfx() {
output="$(git commit "$@")" local output="$(git commit "$@")"
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
${shellsound} ${sndpath}/gitcommit.wav ${shellsound} ${sndpath}/gitcommit.wav
echo "$output" | ${color-commit} echo "$output" | ${color-commit}
@@ -166,6 +170,13 @@ in
${shellsound} ${sndpath}/cd.wav ${shellsound} ${sndpath}/cd.wav
} }
vipe() {
local tmp=$(mktemp)
$EDITOR "$tmp" >/dev/tty </dev/tty
cat "$tmp"
rm "$tmp"
}
if [ "$0" = "-fern" ]; then if [ "$0" = "-fern" ]; then
${shellsound} $FLAKEPATH/assets/sound/login.wav ${shellsound} $FLAKEPATH/assets/sound/login.wav
fi fi

View File

@@ -11,6 +11,9 @@
email = "kylerclay@proton.me"; email = "kylerclay@proton.me";
name = "${username}"; name = "${username}";
}; };
alias = {
draft = "!if git rev-parse > /dev/null 2>&1; then echo \"$1\" >> $(git rev-parse --git-dir)/DRAFT_MSG; else exit 1; fi #";
};
core.pager = "delta"; core.pager = "delta";
interactive.diffFilter = "delta --color-only"; interactive.diffFilter = "delta --color-only";
delta.navigate = "true"; delta.navigate = "true";

View File

@@ -16,6 +16,7 @@ pkgs.writeShellApplication {
"a") if checkbools; then all=true; else echo -e "$usage" && exit 1; fi ;; "a") if checkbools; then all=true; else echo -e "$usage" && exit 1; fi ;;
"s") if checkbools; then system=true; else echo -e "$usage" && exit 1; fi ;; "s") if checkbools; then system=true; else echo -e "$usage" && exit 1; fi ;;
"h") if checkbools; then home=true; else echo -e "$usage" && exit 1; fi ;; "h") if checkbools; then home=true; else echo -e "$usage" && exit 1; fi ;;
"U") if [ "$update" = false ]; then update=true; else echo -e "$usage" && exit 1; fi ;;
"n") if [ "$dry" = false ]; then dry=true; else echo -e "$usage" && exit 1; fi ;; "n") if [ "$dry" = false ]; then dry=true; else echo -e "$usage" && exit 1; fi ;;
*) echo -e "$usage" && exit 1 ;; *) echo -e "$usage" && exit 1 ;;
esac esac
@@ -26,10 +27,14 @@ pkgs.writeShellApplication {
home=false home=false
all=false all=false
dry=false dry=false
update=false
played_start=false
hooray() { playshellsound "${self}/assets/sound/update.wav"; } hooray() { playshellsound "${self}/assets/sound/update.wav"; }
damn() { playshellsound "${self}/assets/sound/error.wav"; } damn() { playshellsound "${self}/assets/sound/error.wav"; }
start() { playshellsound "${self}/assets/sound/nixswitch-start.wav"; } start() { [ "$played_start" = false ] && playshellsound "${self}/assets/sound/nixswitch-start.wav" && played_start=true || true; }
update_done() { playshellsound "${self}/assets/sound/update_alt.wav"; }
usage="\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config, rebuild -a for both. Including 'n' with the flag does a dry run, i.e. rebuild -nh" usage="\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config, rebuild -a for both. Including 'n' with the flag does a dry run, i.e. rebuild -nh"
@@ -43,6 +48,8 @@ pkgs.writeShellApplication {
dry_flag="" dry_flag=""
[ "$dry" = true ] && dry_flag="-n" [ "$dry" = true ] && dry_flag="-n"
[ "$update" = true ] && start && (cd "$FLAKEPATH" && nix flake update) && update_done
[ "$all" = true ] && if sudo sleep 0.1 && start && nh os switch $dry_flag -H "${host}" "$FLAKEPATH" && nh home switch $dry_flag -c "${host}Home" "$FLAKEPATH"; then hooray; else damn; fi [ "$all" = true ] && if sudo sleep 0.1 && start && nh os switch $dry_flag -H "${host}" "$FLAKEPATH" && nh home switch $dry_flag -c "${host}Home" "$FLAKEPATH"; then hooray; else damn; fi
[ "$system" = true ] && start && if nh os switch $dry_flag -H "${host}" "$FLAKEPATH"; then hooray; else damn; fi [ "$system" = true ] && start && if nh os switch $dry_flag -H "${host}" "$FLAKEPATH"; then hooray; else damn; fi
[ "$home" = true ] && start && if nh home switch $dry_flag -c "${host}Home" "$FLAKEPATH"; then hooray; else damn; fi [ "$home" = true ] && start && if nh home switch $dry_flag -c "${host}Home" "$FLAKEPATH"; then hooray; else damn; fi