314 current 2025-02-09 03:18:46 25.05.20241217.d3c42f1 6.6.66 *

This commit is contained in:
2025-02-09 03:18:59 -05:00
parent e6857648cf
commit a9c96ade19
10 changed files with 72 additions and 17 deletions

View File

@@ -16,11 +16,11 @@ in {
./fonts/default.nix # need to manage fonts in two places becuase life sucks nix sucks
];
home.activation.copyScripts = lib.mkAfter ''
mkdir -p ~/.scripts
cp ${./nixos-rebuild.sh} ~/.scripts/
chmod -R u+w ~/.scripts/
'';
# home.activation.copyScripts = lib.mkAfter ''
# mkdir -p ~/.scripts
# cp ${./nixos-rebuild.sh} ~/.scripts/
# chmod -R u+w ~/.scripts/
# '';
home.stateVersion = "24.11"; # Please read the comment before changing.

View File

@@ -1,5 +1,3 @@
#!/bin/bash
if [[ $(bluetoothctl devices) == "No default controller available" ]]; then
echo "click the bluetooth button lol"
exit 1

View File

@@ -1,4 +1,3 @@
#!/bin/bash
xrandr --output HDMI-2 --mode 1920x1080 --same-as eDP-1 --scale 1x1
bspc desktop Desktop --remove
bspc wm -r

View File

@@ -1,4 +1,3 @@
#!/bin/bash
shift="$1"
current=$(bspc query -D -d --names)
#echo "$(($current + 1))"

View File

@@ -1,4 +1,3 @@
#!/bin/bash
xrandr --output HDMI-1 --off
xrandr --output HDMI-2 --off
xrandr --output eDP-1 --mode 1920x1080 --primary

View File

@@ -1,4 +1,3 @@
#!/bin/bash
# swaps the current desktop with selected
shift="$1"
current=$(bspc query -D -d --names)

View File

@@ -1,5 +1,3 @@
#!/bin/sh
usage() {
echo "Usage: ./ytdl [URL] [options]"
echo "Download an mp3 from a given URL, process it, and optionally move it to the music directory."

View File

@@ -1,5 +1,3 @@
#!/bin/bash
MOUNT_POINT="/home/synchronous/android_phone"
# Check if mount point exists, if not, create it

View File

@@ -1,5 +1,3 @@
#!/bin/bash
MOUNT_POINT="/home/synchronous/android_phone"
fusermount -u $MOUNT_POINT
rm -rf $MOUNT_POINT

67
home/scripts/rebuild.sh Normal file
View File

@@ -0,0 +1,67 @@
#!/usr/bin/env bash
# blatently adapted from: https://gist.github.com/0atman/1a5133b842f929ba4c1e195ee67599d5
# set -e
# cd to your config dir
pushd /home/synchronous/nix-cfg
# early return if no changes are given
git --git-dir /home/synchronous/nix-cfg/.git add .
if git --git-dir /home/synchronous/nix-cfg/.git diff-index --quiet HEAD; then
echo "No changes detected, exiting."
popd
exit 0
fi
/run/current-system/sw/bin/nix flake check /home/synchronous/nix-cfg/
# Autoformat your nix files
alejandra . &>/dev/null \
|| ( alejandra . ; echo "formatting failed!" && exit 1)
# shows changes between last commit and head
# git --git-dir /home/synchronous/nix-cfg/.git add .
# git --git-dir /home/synchronous/nix-cfg/.git --no-pager diff -U0
git --git-dir /home/synchronous/nix-cfg/.git --no-pager diff HEAD -U0
# '*.nix'
echo ""
echo "Summary:"
git status --porcelain
echo ""
echo "NixOS Rebuilding..."
# Rebuild, output simplified errors, log trackebacks
sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /home/synchronous/nix-cfg/flake.nix &> /tmp/nixos-switch.log
# cat /tmp/nixos-switch.log | grep --color error && exit 1
if grep --color error /tmp/nixos-switch.log; then
# cat /tmp/nixos-switch.log | grep --color error
read -p "Would you like to view the error log? (y/n): " choice
choice=${choice:-n}
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
cat /tmp/nixos-switch.log
fi
exit 1;
fi
# Get current generation metadata
current=$(nixos-rebuild list-generations | grep current)
# Commit all changes witih the generation metadata
git --git-dir /home/synchronous/nix-cfg/.git add .
git --git-dir /home/synchronous/nix-cfg/.git commit -am "$current"
# Back to where you were
popd
# rm /tmp/nixos-switch.log
# Notify all OK!
notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available
echo ""
echo "Full rebuild log in /tmp/nixos-switch.log"