Merge pull request #53 from cnsta/miscy

cleanup script changes and things i dont rmeember :(
This commit is contained in:
cnsta
2024-09-14 21:25:05 +02:00
committed by GitHub
8 changed files with 345 additions and 247 deletions

View File

@@ -1,11 +1,18 @@
#!/bin/bash #!/bin/bash
# Script to clean up old initrd and kernel files in /boot/EFI/nixos # Script to clean up old initrd and kernel files in /boot/EFI/nixos
# Make sure it's added to flake.nix, then run: #
# "nix build .#packages.x86_64-linux.cleanup-boot". # Build the script with:
# nix build .#packages.x86_64-linux.cleanup-boot
# Run the script with:
# nix run .#cleanup-boot -- --dry-run
# The '--' is required to pass arguments to the script.
#
# This script keeps the latest N kernel/initrd pairs (entries).
# Each entry consists of a kernel and an initrd file identified by the same version number.
# Number of generations to keep # Default number of entries to keep
KEEP_GENERATIONS=4 KEEP_ENTRIES=4
# Log file for cleanup actions # Log file for cleanup actions
LOG_FILE="/var/log/cleanup-boot.log" LOG_FILE="/var/log/cleanup-boot.log"
@@ -13,58 +20,188 @@ LOG_FILE="/var/log/cleanup-boot.log"
# Dry run flag # Dry run flag
DRY_RUN=false DRY_RUN=false
# Check for dry run argument # Include incomplete entries flag
if [ "$1" = "--dry-run" ]; then INCLUDE_INCOMPLETE=false
# Function to display usage information
usage() {
echo "Usage: $0 [--dry-run] [--keep N] [--include-incomplete] [--help]"
echo
echo "Note: When running with 'nix run', use '--' before script arguments."
echo
echo "Options:"
echo " --dry-run Perform a trial run with no changes made."
echo " --keep N Keep the latest N kernel/initrd pairs (default: 4)."
echo " --include-incomplete Include incomplete entries in deletion."
echo " --help, -h Show this help message."
echo
echo "Examples:"
echo " nix run .#cleanup-boot -- --dry-run"
echo " ./result --keep 5"
exit 1
}
# Parse command-line arguments
while [[ "$#" -gt 0 ]]; do
case "$1" in
--dry-run)
DRY_RUN=true DRY_RUN=true
;;
--keep)
if [[ -n "${2:-}" && "$2" =~ ^[0-9]+$ ]]; then
KEEP_ENTRIES="$2"
shift
else
echo "Error: --keep requires a numeric argument."
usage
fi
;;
--include-incomplete)
INCLUDE_INCOMPLETE=true
;;
--help | -h)
usage
;;
*)
echo "Unknown option: $1"
usage
;;
esac
shift
done
# Exit on any error, undefined variable, or pipeline failure
set -euo pipefail
# Check for root privileges
if [ "$EUID" -ne 0 ]; then
echo "Error: Please run as root."
exit 1
fi fi
# Function to log messages # Check if log file is writable
if ! touch "$LOG_FILE" &>/dev/null; then
echo "Error: Cannot write to log file $LOG_FILE"
exit 1
fi
# Function to log messages with timestamps
log() { log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE" echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
} }
# Exit on any error log "Starting cleanup script. Keeping the latest $KEEP_ENTRIES kernel/initrd pairs."
set -e
log "Starting cleanup script. Keeping the latest $KEEP_GENERATIONS generations." # Collect all .efi files in /boot/EFI/nixos
mapfile -t efi_files < <(find /boot/EFI/nixos -type f -name '*.efi')
# List the initrd files in /boot/EFI/nixos sorted by modification time (oldest first) declare -A entries
mapfile -t initrd_files < <(find /boot/EFI/nixos -type f -name '*initrd*.efi' -printf '%T@ %p\n' | sort -n)
# List the kernel files in /boot/EFI/nixos sorted by modification time (oldest first) # Parse filenames to group kernel and initrd files by their version number
mapfile -t kernel_files < <(find /boot/EFI/nixos -type f -name '*kernel*.efi' -printf '%T@ %p\n' | sort -n) for file in "${efi_files[@]}"; do
basename=$(basename "$file")
# Extract the version number
if [[ "$basename" =~ ^(initrd|kernel)-(.*)-(.*)\.efi$ ]]; then
type="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
# hash="${BASH_REMATCH[3]}" # Removed unused variable
elif [[ "$basename" =~ ^(.*)-(.*)-(initrd|kernel)\.efi$ ]]; then
# hash="${BASH_REMATCH[1]}" # Removed unused variable
version="${BASH_REMATCH[2]}"
type="${BASH_REMATCH[3]}"
else
log "Warning: Unrecognized filename format: $basename"
continue
fi
# Count the number of initrd and kernel files key="$version"
initrd_count=${#initrd_files[@]} entries["$key,$type"]="$file"
kernel_count=${#kernel_files[@]}
log "Found $initrd_count initrd files and $kernel_count kernel files." # Store the earliest modification time among kernel and initrd
file_mtime=$(stat -c '%Y' "$file")
existing_mtime="${entries["$key,mtime"]:-}"
if [[ -z "$existing_mtime" ]] || [[ "$file_mtime" -lt "$existing_mtime" ]]; then
entries["$key,mtime"]="$file_mtime"
fi
done
# Initialize arrays to hold files to delete # Decide whether to include incomplete entries
delete_initrd_files=() declare -A valid_entries
delete_kernel_files=()
# If there are fewer than KEEP_GENERATIONS initrd files, don't delete any if [ "$INCLUDE_INCOMPLETE" = true ]; then
if [ "$initrd_count" -le "$KEEP_GENERATIONS" ]; then # Include all entries
log "Fewer than $KEEP_GENERATIONS initrd files found. No initrd files will be deleted." for key in "${!entries[@]}"; do
if [[ "$key" =~ ,mtime$ ]]; then
version="${key%,mtime}"
valid_entries["$version,initrd"]="${entries["$version,initrd"]:-}"
valid_entries["$version,kernel"]="${entries["$version,kernel"]:-}"
valid_entries["$version,mtime"]="${entries["$version,mtime"]}"
fi
done
else else
# Get the initrd files to delete # Include only complete entries
delete_initrd_files=("${initrd_files[@]:0:initrd_count-KEEP_GENERATIONS}") for key in "${!entries[@]}"; do
if [[ "$key" =~ ,mtime$ ]]; then
version="${key%,mtime}"
if [[ -n "${entries["$version,initrd"]:-}" && -n "${entries["$version,kernel"]:-}" ]]; then
valid_entries["$version,initrd"]="${entries["$version,initrd"]}"
valid_entries["$version,kernel"]="${entries["$version,kernel"]}"
valid_entries["$version,mtime"]="${entries["$version,mtime"]}"
else
log "Warning: Incomplete entry detected for version $version."
fi
fi
done
fi fi
# If there are fewer than KEEP_GENERATIONS kernel files, don't delete any # Sort the entries by modification time (newest first)
if [ "$kernel_count" -le "$KEEP_GENERATIONS" ]; then mapfile -t sorted_entries < <(
log "Fewer than $KEEP_GENERATIONS kernel files found. No kernel files will be deleted." for key in "${!valid_entries[@]}"; do
else if [[ "$key" =~ ,mtime$ ]]; then
# Get the kernel files to delete version="${key%,mtime}"
delete_kernel_files=("${kernel_files[@]:0:kernel_count-KEEP_GENERATIONS}") mtime="${valid_entries[$key]}"
echo "$mtime:$version"
fi
done | sort -rn | awk -F: '{print $2}'
)
# Remove duplicates
unique_versions=()
declare -A seen_versions
for version in "${sorted_entries[@]}"; do
if [[ -z "${seen_versions[$version]:-}" ]]; then
unique_versions+=("$version")
seen_versions["$version"]=1
fi
done
entry_count=${#unique_versions[@]}
log "Found $entry_count kernel/initrd pairs."
if [ "$entry_count" -le "$KEEP_ENTRIES" ]; then
log "Fewer than or equal to $KEEP_ENTRIES pairs found. No files will be deleted."
exit 0
fi fi
# Determine entries to delete
entries_to_delete=("${unique_versions[@]:$KEEP_ENTRIES}")
# Log the files identified for deletion # Log the files identified for deletion
log "Files identified for deletion:" log "Files identified for deletion:"
for file_entry in "${delete_initrd_files[@]}" "${delete_kernel_files[@]}"; do delete_files=()
file=$(echo "$file_entry" | cut -d' ' -f2-) for version in "${entries_to_delete[@]}"; do
log "$file" initrd_file="${valid_entries["$version,initrd"]:-}"
kernel_file="${valid_entries["$version,kernel"]:-}"
if [ -n "$initrd_file" ]; then
delete_files+=("$initrd_file")
log "$initrd_file"
fi
if [ -n "$kernel_file" ]; then
delete_files+=("$kernel_file")
log "$kernel_file"
fi
done done
# Confirm dry run mode # Confirm dry run mode
@@ -73,8 +210,13 @@ if [ "$DRY_RUN" = true ]; then
fi fi
# Remove old files # Remove old files
for file_entry in "${delete_initrd_files[@]}" "${delete_kernel_files[@]}"; do for file in "${delete_files[@]}"; do
file=$(echo "$file_entry" | cut -d' ' -f2-) # Security check: Ensure the file is within /boot/EFI/nixos
if [[ "$file" != /boot/EFI/nixos/* ]]; then
log "Warning: Attempted to delete file outside of /boot/EFI/nixos: $file"
continue
fi
if [ "$DRY_RUN" = false ]; then if [ "$DRY_RUN" = false ]; then
if rm -f "$file"; then if rm -f "$file"; then
log "Deleted: $file" log "Deleted: $file"

265
flake.lock generated
View File

@@ -61,11 +61,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725199881, "lastModified": 1725753098,
"narHash": "sha256-jsmipf/u1GFZE5tBUkr56CHMN6VpUWCAjfLIhvQijU0=", "narHash": "sha256-/NO/h/qD/eJXAQr/fHA4mdDgYsNT9thHQ+oT6KPi2ac=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "aquamarine", "repo": "aquamarine",
"rev": "f8a687dd29ff019657498f1bd14da2fbbf0e604b", "rev": "e4a13203112a036fc7f437d391c7810f3dd5ab52",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -92,42 +92,25 @@
}, },
"chaotic": { "chaotic": {
"inputs": { "inputs": {
"compare-to": "compare-to",
"fenix": "fenix", "fenix": "fenix",
"flake-schemas": "flake-schemas", "flake-schemas": "flake-schemas",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"jovian": "jovian", "jovian": "jovian",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3"
"systems": "systems_3",
"yafas": "yafas"
}, },
"locked": { "locked": {
"lastModified": 1725738693, "lastModified": 1726248336,
"narHash": "sha256-nqsRStEB29KcTsMC52NdKFzd0PSudQHY6w6oRrNyLCM=", "narHash": "sha256-e7gRQHB6dnvzjBZuAaWOO8adYZLodoxFir9YI0TyW6M=",
"rev": "38451822a144faa53a7ee96d4f0478d94945b67a", "rev": "f43f7397b3eec7a047783d384afe1faddebb6761",
"revCount": 1392, "revCount": 1409,
"type": "tarball", "type": "tarball",
"url": "https://api.flakehub.com/f/pinned/chaotic-cx/nyx/0.1.1392%2Brev-38451822a144faa53a7ee96d4f0478d94945b67a/0191ce0d-dd9c-78a8-a5b2-d1c9070acb04/source.tar.gz?rev=38451822a144faa53a7ee96d4f0478d94945b67a&revCount=1392" "url": "https://api.flakehub.com/f/pinned/chaotic-cx/nyx/0.1.1409%2Brev-f43f7397b3eec7a047783d384afe1faddebb6761/0191ec7a-8f02-7dac-a221-74163f795ff8/source.tar.gz?rev=f43f7397b3eec7a047783d384afe1faddebb6761&revCount=1409"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://flakehub.com/f/chaotic-cx/nyx/%2A.tar.gz" "url": "https://flakehub.com/f/chaotic-cx/nyx/%2A.tar.gz"
} }
}, },
"compare-to": {
"locked": {
"lastModified": 1695341185,
"narHash": "sha256-htO6DSbWyCgaDkxi7foPjXwJFPzGjVt3RRUbPSpNtZY=",
"rev": "98b8e330823a3570d328720f87a1153f8a7f2224",
"revCount": 2,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/chaotic-cx/nix-empty-flake/0.1.2%2Brev-98b8e330823a3570d328720f87a1153f8a7f2224/018aba35-d228-7fa9-b205-7616c89ef4e0/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/chaotic-cx/nix-empty-flake/%3D0.1.2.tar.gz"
}
},
"crane": { "crane": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -201,11 +184,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1725690497, "lastModified": 1726036322,
"narHash": "sha256-5fT+96rV7Hx29HG+4/oBbr3V+yExKuLN2vcBcPbVBlU=", "narHash": "sha256-9Hwl4lzB5yFah00OaXSMDPDubCy99wtLgsYxMVpMwlM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "4b8d964df93d1f918ee6c4f003b3548c432cc866", "rev": "3e50a3c915882f07cb3f6c246f09febc4ad36c3e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -222,11 +205,11 @@
"rust-analyzer-src": "rust-analyzer-src_2" "rust-analyzer-src": "rust-analyzer-src_2"
}, },
"locked": { "locked": {
"lastModified": 1725777030, "lastModified": 1726230467,
"narHash": "sha256-mieHgCmdbr/Tok3djbEVnNyLtnxEv5PHngN8wBu+RJA=", "narHash": "sha256-YyMNF7IFyysZ2KeqEO6AmV3nQeaDSxyNXLdHp1ghO60=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "7c59cc75e7d2328753b00766ab0a78a075609b25", "rev": "43efa7a3a97f290441bd75b18defcd4f7b8df220",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -244,11 +227,11 @@
}, },
"locked": { "locked": {
"dir": "pkgs/firefox-addons", "dir": "pkgs/firefox-addons",
"lastModified": 1725783932, "lastModified": 1726310681,
"narHash": "sha256-ZrDE5yqkgiv0F34w1QFz1oZnNnReW0PEA6vjO6gx4Uc=", "narHash": "sha256-qqOi+qmUN12GEi6LkLRfdR6B3r/3vCQUkKnEwWv8LV8=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "58ac93a2ade218ea5e4dae38246030c7342b1eb4", "rev": "1722f681109568b070bacb824880074d8e9d3d8f",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@@ -269,11 +252,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725798678, "lastModified": 1726317119,
"narHash": "sha256-Aziin6ZR/fZnyNPJnT0ZbvVpKWKzsH9rXn4We96N39k=", "narHash": "sha256-40WAa5/83zGfb26GfkGX/tnxcEeQlL2VqibyR+u056U=",
"owner": "nix-community", "owner": "nix-community",
"repo": "flake-firefox-nightly", "repo": "flake-firefox-nightly",
"rev": "21b12476f57478f078d04774ed63d897ef8c5c20", "rev": "9936f08d0694ea0684b5fbfe7b047e71fe3b5269",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -356,11 +339,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725234343, "lastModified": 1726153070,
"narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -392,16 +375,16 @@
}, },
"flake-schemas": { "flake-schemas": {
"locked": { "locked": {
"lastModified": 1693491534, "lastModified": 1721999734,
"narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=", "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=",
"rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279", "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982",
"revCount": 21, "revCount": 75,
"type": "tarball", "type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz" "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.1.tar.gz" "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz"
} }
}, },
"flake-utils": { "flake-utils": {
@@ -421,7 +404,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@@ -459,7 +442,7 @@
}, },
"flake-utils_4": { "flake-utils_4": {
"inputs": { "inputs": {
"systems": "systems_5" "systems": "systems_4"
}, },
"locked": { "locked": {
"lastModified": 1709126324, "lastModified": 1709126324,
@@ -477,7 +460,7 @@
}, },
"flake-utils_5": { "flake-utils_5": {
"inputs": { "inputs": {
"systems": "systems_8" "systems": "systems_7"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@@ -534,11 +517,11 @@
}, },
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1725716377, "lastModified": 1725885300,
"narHash": "sha256-7NzW9O/cAw7iWzRfh7Oo/SuSudL4a1YTKS6yoh3tMck=", "narHash": "sha256-5RLEnou1/GJQl+Wd+Bxaj7QY7FFQ9wjnFq1VNEaxTmc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "04a1cda0c1725094a4db703cccbb956b7558f5a6", "rev": "166dee4f88a7e3ba1b7a243edb1aca822f00680e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -572,11 +555,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1725488664, "lastModified": 1726100921,
"narHash": "sha256-am2gEtxtHwlui3Tj3yel7l3UZsXk6TMfWsaO8g5/Re4=", "narHash": "sha256-HCvWDEQ5kxOk3+nXzQQlxC/9oSpAZOW5rFoQQXe1TWM=",
"owner": "SoraTenshi", "owner": "SoraTenshi",
"repo": "helix", "repo": "helix",
"rev": "77264d371f0f1c641209ae6dc55b211f8762a311", "rev": "77e8d3fef5dde1e544d75ed0ffa9c1a89245f1a4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -618,11 +601,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725781935, "lastModified": 1726308872,
"narHash": "sha256-o6LRtdpgBTzev9n243Ktu3rn0/qsv0frFyJwU6vJsdE=", "narHash": "sha256-d4vwO5N4RsLnCY7k5tY9xbdYDWQsY3RDMeUoIa4ms2A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "ec4c6928bbacc89cf10e9c959a7a47cbaad95344", "rev": "6c1a461a444e6ccb3f3e42bb627b510c3a722a57",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -660,11 +643,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725694918, "lastModified": 1726036828,
"narHash": "sha256-+HsjshXpqNiJHLaJaK0JnIicJ/a1NquKcfn4YZ3ILgg=", "narHash": "sha256-ZQHbpyti0jcAKnwQY1lwmooecLmSG6wX1JakQ/eZNeM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "aaebdea769a5c10f1c6e50ebdf5924c1a13f0cda", "rev": "8a1671642826633586d12ac3158e463c7a50a112",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -743,15 +726,15 @@
"hyprutils": "hyprutils", "hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner", "hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_5",
"systems": "systems_6", "systems": "systems_5",
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1725814101, "lastModified": 1726246604,
"narHash": "sha256-+wE97utoDfhQP6AMdZHUmBeL8grbce/Jv2i5M+6AbaE=", "narHash": "sha256-cScS34F71HzhIUeMScfKrT7iSZA0tr8pGIjOqHF+ue8=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "0f594732b063a90d44df8c5d402d658f27471dfe", "rev": "d35e70a8c6599bb058cf86eb87c783ce1cf72471",
"revCount": 5196, "revCount": 5218,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/hyprwm/Hyprland" "url": "https://github.com/hyprwm/Hyprland"
@@ -826,11 +809,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725188252, "lastModified": 1725997860,
"narHash": "sha256-yBH8c4GDaEAtBrh+BqIlrx5vp6gG/Gu8fQQK63KAQgs=", "narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprlang", "repo": "hyprlang",
"rev": "c12ab785ce1982f82594aff03b3104c598186ddd", "rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -990,11 +973,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725600800, "lastModified": 1726031155,
"narHash": "sha256-wst7p3RZ9kZUNzN22d27wU8YSBB7Grlx6Q03A7boRaU=", "narHash": "sha256-QUv5cxy40HRC7vJz9JjbVEmlHT+q1VIuikNJUQZHre0=",
"owner": "Jovian-Experiments", "owner": "Jovian-Experiments",
"repo": "Jovian-NixOS", "repo": "Jovian-NixOS",
"rev": "2d050e65a71e02a1f19d1a35c086bd2e3dfb2cdb", "rev": "90c68db7d9430bd30e8c5096a0e3dc078b410050",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1107,11 +1090,11 @@
"umu": "umu" "umu": "umu"
}, },
"locked": { "locked": {
"lastModified": 1725759635, "lastModified": 1726104489,
"narHash": "sha256-ud4X/spA6YV0po5UgKOA7R2qHl/pimWHzgs0NXPgh84=", "narHash": "sha256-nn2Rp6Op78xWF8OJa0utad8yvrxf93K7BcOEwPtafg8=",
"owner": "fufexan", "owner": "fufexan",
"repo": "nix-gaming", "repo": "nix-gaming",
"rev": "ec0bcaccd0026422f35d0ef17e91cff61bdcc805", "rev": "3a97598cb9ca7eed51bc361b025ed26cc52852e0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1154,11 +1137,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725503605, "lastModified": 1726108208,
"narHash": "sha256-P/3wqoBMbQfjEtweRIzUBRWL7yj52ODsVPMinvOCFhQ=", "narHash": "sha256-kMjJvLNMtjxlBP2NooPSuhGzp3Q+xPeFwzrknOsdl9k=",
"owner": "nixpak", "owner": "nixpak",
"repo": "nixpak", "repo": "nixpak",
"rev": "baa4b365dd20aa5b56f73bc446e2970a3089c145", "rev": "2e2d0b7e0fb18c49b585f8ad77c3a64fa819bf93",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1200,11 +1183,11 @@
}, },
"nixpkgs-small": { "nixpkgs-small": {
"locked": { "locked": {
"lastModified": 1725804652, "lastModified": 1726220054,
"narHash": "sha256-KgSE/TQaomgbIO5KKKo6kgdlFlxVGpVn4eucGK3jl20=", "narHash": "sha256-Q3V+VtbSMlD2GNmW8xqN/6hz56gE1EekKpHTyO9hiT4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2f46ad5dd5c22cf18331773e346dfc5ae17edd88", "rev": "537289eed405d1f7653cf02bff9186dfa3f9b344",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1248,11 +1231,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1725634671, "lastModified": 1726062873,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1280,11 +1263,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1725103162, "lastModified": 1725983898,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", "narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", "rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1327,11 +1310,11 @@
}, },
"nixpkgs_8": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1725634671, "lastModified": 1726062873,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1393,18 +1376,18 @@
"nixpak": "nixpak", "nixpak": "nixpak",
"nixpkgs": "nixpkgs_8", "nixpkgs": "nixpkgs_8",
"nixpkgs-small": "nixpkgs-small", "nixpkgs-small": "nixpkgs-small",
"systems": "systems_7", "systems": "systems_6",
"wezterm": "wezterm" "wezterm": "wezterm"
} }
}, },
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1725630423, "lastModified": 1725985110,
"narHash": "sha256-gNCLk3Zg7JlAwmWbVHTH6f3+iqdeQ4fheOotCZy8x5M=", "narHash": "sha256-0HKj+JI6rtxaE6Kzcd6HyFNbEFJRsLy5DoNgVF1pyRM=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "08c7bbc2dbe4dcc8968484f1a0e1e6fe7a1d4f6d", "rev": "bcc708992104c2059f310fbc3ac00bfc377f9ea8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1417,11 +1400,11 @@
"rust-analyzer-src_2": { "rust-analyzer-src_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1725630423, "lastModified": 1725985110,
"narHash": "sha256-gNCLk3Zg7JlAwmWbVHTH6f3+iqdeQ4fheOotCZy8x5M=", "narHash": "sha256-0HKj+JI6rtxaE6Kzcd6HyFNbEFJRsLy5DoNgVF1pyRM=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "08c7bbc2dbe4dcc8968484f1a0e1e6fe7a1d4f6d", "rev": "bcc708992104c2059f310fbc3ac00bfc377f9ea8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1485,11 +1468,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1721441897, "lastModified": 1725675754,
"narHash": "sha256-gYGX9/22tPNeF7dR6bWN5rsrpU4d06GnQNNgZ6ZiXz0=", "narHash": "sha256-hXW3csqePOcF2e/PYnpXj72KEYyNj2HzTrVNmS/F7Ug=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "b7996075da11a2d441cfbf4e77c2939ce51506fd", "rev": "8cc45e678e914a16c8e224c3237fb07cf21e5e54",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1530,16 +1513,16 @@
}, },
"systems_3": { "systems_3": {
"locked": { "locked": {
"lastModified": 1689347949, "lastModified": 1681028828,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems", "owner": "nix-systems",
"repo": "default-linux", "repo": "default",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "owner": "nix-systems",
"repo": "default-linux", "repo": "default",
"type": "github" "type": "github"
} }
}, },
@@ -1560,16 +1543,16 @@
}, },
"systems_5": { "systems_5": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1689347949,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems", "owner": "nix-systems",
"repo": "default", "repo": "default-linux",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "owner": "nix-systems",
"repo": "default", "repo": "default-linux",
"type": "github" "type": "github"
} }
}, },
@@ -1589,21 +1572,6 @@
} }
}, },
"systems_7": { "systems_7": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_8": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@@ -1627,11 +1595,11 @@
}, },
"locked": { "locked": {
"dir": "packaging/nix", "dir": "packaging/nix",
"lastModified": 1725408497, "lastModified": 1726301236,
"narHash": "sha256-wyJPWwHzHpFwc9XP9nM/Lpbvahusp2NcUtWXlErGi1g=", "narHash": "sha256-0JQH9RYdGL1NUaQE5syA/SmbxuZ6NTLn3FduapSXUXA=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "2d3c948a51bc1d2880a90bf985947f9afc89e8d1", "rev": "e06443981e3bf09cbc70aaffe245e4a03f1a6df7",
"revCount": 713, "revCount": 715,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/Open-Wine-Components/umu-launcher/" "url": "https://github.com/Open-Wine-Components/umu-launcher/"
@@ -1657,11 +1625,11 @@
}, },
"locked": { "locked": {
"dir": "nix", "dir": "nix",
"lastModified": 1723525023, "lastModified": 1726339510,
"narHash": "sha256-ZsDJQSUokodwFMP4FIZm2dYojf5iC4F/EeKC5VuQlqY=", "narHash": "sha256-usBvEjcRlFOtsAvKgnWuiNTrUAogSCuzIpQQQWvbWTM=",
"owner": "wez", "owner": "wez",
"repo": "wezterm", "repo": "wezterm",
"rev": "30345b36d8a00fed347e4df5dadd83915a7693fb", "rev": "3a4125e728a9051565d0af5fe5a8805bc29d1fb4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1689,11 +1657,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1725203932, "lastModified": 1726046979,
"narHash": "sha256-VLULC/OnI+6R9KEP2OIGk+uLJJsfRlaLouZ5gyFd2+Y=", "narHash": "sha256-6SEsjurq9cdTkITA6d49ncAJe4O/8CgRG5/F//s6Xh8=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "2425e8f541525fa7409d9f26a8ffaf92a3767251", "rev": "e695669fd8e1d1be9eaae40f35e00f8bd8b64c18",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1702,31 +1670,6 @@
"type": "github" "type": "github"
} }
}, },
"yafas": {
"inputs": {
"flake-schemas": [
"chaotic",
"flake-schemas"
],
"systems": [
"chaotic",
"systems"
]
},
"locked": {
"lastModified": 1695926485,
"narHash": "sha256-wNFFnItckgSs8XeYhhv8vlJs2WF09fSQaWgw4xkDqHQ=",
"owner": "UbiqueLambda",
"repo": "yafas",
"rev": "7772afd6686458ca0ddbc599a52cf5d337367653",
"type": "github"
},
"original": {
"owner": "UbiqueLambda",
"repo": "yafas",
"type": "github"
}
},
"zlib": { "zlib": {
"flake": false, "flake": false,
"locked": { "locked": {

View File

@@ -5,7 +5,6 @@
imports = [ imports = [
./alpha.nix ./alpha.nix
./bufferline.nix ./bufferline.nix
./comment.nix
./copilot.nix ./copilot.nix
./fidget.nix ./fidget.nix
./gitsigns.nix ./gitsigns.nix

View File

@@ -6,7 +6,14 @@
... ...
}: let }: let
inherit (lib) mkIf mkEnableOption; inherit (lib) mkIf mkEnableOption;
modKey = if osConfig.networking.hostName == "cnixpad" then "ALT_L" else "SUPER"; modKey =
if osConfig.networking.hostName == "cnixpad"
then "ALT_L"
else "SUPER";
term =
if osConfig.networking.hostName == "cnixpad"
then "alacritty"
else "wezterm";
cfg = config.modules.wm.hyprland.cnst.keybinds; cfg = config.modules.wm.hyprland.cnst.keybinds;
in { in {
options = { options = {
@@ -14,7 +21,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
"$terminal" = "wezterm"; "$terminal" = term;
"$fileManager" = "thunar"; "$fileManager" = "thunar";
"$passwordManager" = "keepassxc"; "$passwordManager" = "keepassxc";
"$menu" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --"; "$menu" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --";
@@ -22,6 +29,7 @@ in {
"$browser" = "firefox"; "$browser" = "firefox";
"$browserinc" = "firefox --private-window"; "$browserinc" = "firefox --private-window";
"$yazi" = "wezterm -e yazi"; "$yazi" = "wezterm -e yazi";
"$runix" = "runix.sh";
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
"$mod" = modKey; "$mod" = modKey;
@@ -44,6 +52,7 @@ in {
#bind = $mod, M, exec, hyprctl dispatch exit #bind = $mod, M, exec, hyprctl dispatch exit
#bind = $mod, E, exec, $fileManager #bind = $mod, E, exec, $fileManager
"$mod, E, exec, $fileManager" "$mod, E, exec, $fileManager"
"$mod, r, exec, $runix"
"$mod SHIFT, E, exec, $yazi" "$mod SHIFT, E, exec, $yazi"
"$mod, F, fullscreen," "$mod, F, fullscreen,"
"$mod SHIFT, F, togglefloating," "$mod SHIFT, F, togglefloating,"

View File

@@ -16,6 +16,10 @@ in {
"float,initialTitle:(floatcal)" "float,initialTitle:(floatcal)"
"size 843 650,initialTitle:(floatcal)" "size 843 650,initialTitle:(floatcal)"
"move 100%-w-20 40,initialTitle:(floatcal)" "move 100%-w-20 40,initialTitle:(floatcal)"
"float,initialTitle:(runix)"
"size 600 400,initialTitle:(runix)"
"center,initialTitle:(runix)"
"workspace special:runix,initialTitle:(runix)"
#windowrulev2 = move 1708 32,class:(floatcal) #windowrulev2 = move 1708 32,class:(floatcal)
"float,class:(org.keepassxc.KeePassXC)" "float,class:(org.keepassxc.KeePassXC)"
"size 843 500,class:(org.keepassxc.KeePassXC)" "size 843 500,class:(org.keepassxc.KeePassXC)"

View File

@@ -2,14 +2,14 @@
inherit (lib) mkForce; inherit (lib) mkForce;
in { in {
modules = { modules = {
# browsers = { browsers = {
# firefox = { # firefox = {
# enable = mkForce true; # enable = mkForce true;
# }; # };
# chromium = { chromium = {
# enable = mkForce true; enable = mkForce false;
# }; };
# }; };
# comm = { # comm = {
# discord = { # discord = {
# enable = mkForce true; # enable = mkForce true;
@@ -34,7 +34,7 @@ in {
# enable = mkForce false; # enable = mkForce false;
# }; # };
# }; # };
# terminal = { terminal = {
# alacritty = { # alacritty = {
# enable = mkForce true; # enable = mkForce true;
# }; # };
@@ -44,13 +44,13 @@ in {
# kitty = { # kitty = {
# enable = mkForce true; # enable = mkForce true;
# }; # };
# wezterm = { wezterm = {
# enable = mkForce true; enable = mkForce false;
# }; };
# zellij = { # zellij = {
# enable = mkForce false; # enable = mkForce false;
# }; # };
# }; };
# userd = { # userd = {
# copyq = { # copyq = {
# enable = mkForce true; # enable = mkForce true;

View File

@@ -37,7 +37,7 @@ in {
boot = { boot = {
consoleLogLevel = 3; consoleLogLevel = 3;
kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos; kernelPackages = lib.mkForce pkgs.linuxPackages_latest;
kernelParams = [ kernelParams = [
"amd_pstate=active" "amd_pstate=active"
"quiet" "quiet"

View File

@@ -37,6 +37,7 @@
"${systemModules}/sysd/system/zram" "${systemModules}/sysd/system/zram"
"${systemModules}/utils/android" "${systemModules}/utils/android"
"${systemModules}/utils/anyrun" "${systemModules}/utils/anyrun"
"${systemModules}/utils/brightnessctl"
"${systemModules}/utils/corectrl" "${systemModules}/utils/corectrl"
"${systemModules}/utils/microfetch" "${systemModules}/utils/microfetch"
"${systemModules}/utils/misc" "${systemModules}/utils/misc"