nixos-configs/scopedPackages/lovelace-components/custom-sidebar/update.sh
matt1432 838df34dfb
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: rename legacyPackages to scopedPackages
2024-11-20 15:17:55 -05:00

13 lines
455 B
Bash

#!/usr/bin/env bash
file="$FLAKE/scopedPackages/lovelace-components/custom-sidebar/default.nix"
old_hash="$(sed -n 's/.*hash = "\(.*\)";/\1/p' "$file")"
sed -i "s/hash = .*/hash = \"\";/" "$file"
npm_hash="$(nix build "$FLAKE#lovelace-components.custom-sidebar" |& sed -n 's/.*got: *//p')"
if [[ "$npm_hash" != "$old_hash" ]]; then
sed -i "s#hash = .*#hash = \"$npm_hash\";#" "$file"
else
sed -i "s#hash = .*#hash = \"$old_hash\";#" "$file"
fi