nixos-configs/scopedPackages/lovelace-components/custom-sidebar/update.sh
matt1432 e697963b46
All checks were successful
Discord / discord commits (push) Has been skipped
fix(update): adjust custom-sidebar script
2024-11-21 15:00:13 -05:00

13 lines
483 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#scopedPackages.x86_64-linux.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