Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 39 additions & 54 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,68 +51,53 @@
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
];

# Helper function to create home-manager configuration
mkHomeManagerConfig =
{ username, stateVersion }:
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
users.${username} = mkHomeConfig {
inherit username stateVersion;
};
};
};

# Helper function to create a NixOS system configuration
mkSystem =
{ hostPath, user, extraModules ? [ ] }:
nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = commonModules ++ [
hostPath
{ inherit user; }
(mkHomeManagerConfig {
username = user;
stateVersion = "25.05";
})
] ++ extraModules;
};
in
{

nixosConfigurations = {
laptop = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = commonModules ++ [
./hosts/laptop
{ user = "none"; }
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
users.none = mkHomeConfig {
username = "none";
stateVersion = "25.05";
};
};
}
];
laptop = mkSystem {
hostPath = ./hosts/laptop;
user = "none";
};

VNPC-21 = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = commonModules ++ [
./hosts/vnpc-21
{ user = "odin"; }
nixos-hardware.nixosModules.lenovo-thinkpad-p53
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
};
users.odin = mkHomeConfig {
username = "odin";
stateVersion = "25.05";
};
};
}
];
VNPC-21 = mkSystem {
hostPath = ./hosts/vnpc-21;
user = "odin";
extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-p53 ];
};

station = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = commonModules ++ [
./hosts/station
{ user = "none"; }
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
users.none = mkHomeConfig {
username = "none";
stateVersion = "25.05";
};
};
}
];
station = mkSystem {
hostPath = ./hosts/station;
user = "none";
};
};

Expand Down
8 changes: 4 additions & 4 deletions modules/home-manager/cli/zsh/scripts/quote.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
len=$(cat $DIR/quotes | wc -l)
len=$(wc -l < "$DIR/quotes")
len=$((len-5))
rand=$((RANDOM%len))

# while random line picked
# is less than number of lines in quotes file
# check if number is divisible by 4
while [ $rand -lt $len ]
while [ "$rand" -lt "$len" ]
do
if (( $rand % 4 == 0 ))
if (( rand % 4 == 0 ))
then
finish=$((rand+3))
head -"$finish" $DIR/quotes | tail -3
head -"$finish" "$DIR/quotes" | tail -3
break
fi
((rand++))
Expand Down
10 changes: 5 additions & 5 deletions modules/home-manager/desktop/bspwm/dotfiles/polybar-launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
killall -q polybar

# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
while pgrep -u "$UID" -x polybar >/dev/null; do sleep 1; done

# Launch Polybar on all monitors
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
MONITOR=$m polybar --reload example &
done
if type xrandr >/dev/null 2>&1; then
while IFS= read -r monitor; do
MONITOR="$monitor" polybar --reload example &
done < <(xrandr --query | grep " connected" | cut -d" " -f1)
else
polybar --reload example &
fi
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

uptime=$(uptime | awk -F, '{sub(".*up ",x,$1);print $1}')
echo $uptime
echo "$uptime"
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
cachedir=~/.cache/rbn
cachefile=${0##*/}-$1

if [ ! -d $cachedir ]; then
mkdir -p $cachedir
if [ ! -d "$cachedir" ]; then
mkdir -p "$cachedir"
fi

if [ ! -f $cachedir/$cachefile ]; then
touch $cachedir/$cachefile
if [ ! -f "$cachedir/$cachefile" ]; then
touch "$cachedir/$cachefile"
fi

# Save current IFS
Expand All @@ -17,24 +17,24 @@ SAVEIFS=$IFS
IFS=$'\n'

cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1))
echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile
echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
if [ "$cacheage" -gt 1740 ] || [ ! -s "$cachedir/$cachefile" ]; then
mapfile -t data < <(curl -s "https://en.wttr.in/$1?0qnT" 2>&1)
echo "${data[0]}" | cut -f1 -d, > "$cachedir/$cachefile"
echo "${data[1]}" | sed -E 's/^.{15}//' >> "$cachedir/$cachefile"
echo "${data[2]}" | sed -E 's/^.{15}//' >> "$cachedir/$cachefile"
fi

weather=($(cat $cachedir/$cachefile))
mapfile -t weather < "$cachedir/$cachefile"

# Restore IFSClear
IFS=$SAVEIFS

temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]])+\.\./\1 to /g')
temperature=$(echo "${weather[2]}" | sed -E 's/([[:digit:]])+\.\./\1 to /g')

#echo ${weather[1]##*,}

# https://fontawesome.com/icons?s=solid&c=weather
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
case $(echo "${weather[1]##*,}" | tr '[:upper:]' '[:lower:]') in
"clear" | "sunny")
condition=""
;;
Expand Down Expand Up @@ -76,4 +76,4 @@ esac

#echo $temp $condition

echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
echo -e "{\"text\":\"$temperature $condition\", \"alt\":\"${weather[0]}\", \"tooltip\":\"${weather[0]}: $temperature ${weather[1]}\"}"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def format_time(time):


def format_temp(temp):
return (hour['FeelsLikeC']+"°").ljust(3)
return (temp+"°").ljust(3)


def format_chances(hour):
Expand Down
4 changes: 3 additions & 1 deletion modules/home-manager/desktop/hyprland/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
# Startup applications
exec-once = [
"pypr"
"hyprpanel & ~/.config/hypr/random-wallpaper.sh & swaync"
"hyprpanel"
"~/.config/hypr/random-wallpaper.sh"
"swaync"
"hyprctl setcursor Bibate-Modern-Ice 18"
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"nm-applet --indicator"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if [ ! -d "$WALLPAPER_DIR" ] || [ -z "$(ls -A "$WALLPAPER_DIR" 2>/dev/null)" ];
exit 1
fi

# Find all image files (follow symlinks with -L)
WALLPAPERS=($(find -L "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" -o -iname "*.gif" \) 2>/dev/null))
# Find all image files (follow symlinks with -L) - use mapfile for efficiency
mapfile -t WALLPAPERS < <(find -L "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" -o -iname "*.gif" \) 2>/dev/null)

# Check if any wallpapers were found
if [ ${#WALLPAPERS[@]} -eq 0 ]; then
Expand Down
9 changes: 5 additions & 4 deletions scripts/flake-rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env bash

if [ ! -z $1 ]; then
export HOST=$1
if [ -n "$1" ]; then
HOST="$1"
else
export HOST=$(hostname)
HOST=$(hostname)
fi
export HOST

sudo nixos-rebuild --impure --flake .#$HOST switch
sudo nixos-rebuild --impure --flake ".#$HOST" switch