mirror of
https://github.com/cucumber-sp/yandex-music-linux.git
synced 2024-12-24 14:34:39 +03:00
[update/flake] Fix flake.lock update periodicity
Check if exe binary was update first, then update all flake.lock only when exe was updated. Change-Id: I3ae7e7453cfe4ea78d1c4e598cc4a3370cd12f1d
This commit is contained in:
parent
d53f330413
commit
3f09e2e0d1
2
.github/workflows/update_packages.sh
vendored
2
.github/workflows/update_packages.sh
vendored
@ -16,8 +16,8 @@ case $OS in
|
|||||||
"Arch Linux")
|
"Arch Linux")
|
||||||
echo "Arch Linux"
|
echo "Arch Linux"
|
||||||
pacman -S --noconfirm git sudo base-devel jq nix
|
pacman -S --noconfirm git sudo base-devel jq nix
|
||||||
sh ./utility/generate_packages.sh
|
|
||||||
git config --global --add safe.directory "*"
|
git config --global --add safe.directory "*"
|
||||||
|
sh ./utility/generate_packages.sh
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Operating system is not recognized."
|
echo "Operating system is not recognized."
|
||||||
|
@ -70,10 +70,35 @@ update_pkbuild() {
|
|||||||
sed -i "s#%exe_sha256%#$exe_sha256#g" ./PKGBUILD
|
sed -i "s#%exe_sha256%#$exe_sha256#g" ./PKGBUILD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_nix_version_2_19() {
|
||||||
|
local version re major minor
|
||||||
|
|
||||||
|
version="$(nix --version | awk '{print $3}')"
|
||||||
|
re='([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)'
|
||||||
|
if [[ $version =~ $re ]]; then
|
||||||
|
major="${BASH_REMATCH[1]}"
|
||||||
|
minor="${BASH_REMATCH[2]}"
|
||||||
|
if [ "$major" -gt 2 ] || [ "$minor" -ge 19 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
update_flake() {
|
update_flake() {
|
||||||
|
local nixcmd="nix --extra-experimental-features nix-command --extra-experimental-features flakes"
|
||||||
sed -i 's#\(ymExe\.url\s*=\s*\).*;#\1'"$exe_link"';#' ./flake.nix
|
sed -i 's#\(ymExe\.url\s*=\s*\).*;#\1'"$exe_link"';#' ./flake.nix
|
||||||
if check_dep nix; then
|
if check_dep nix; then
|
||||||
nix --extra-experimental-features 'nix-command flakes' flake update
|
# Starting from 2.19 the interface of `nix flake` command changed. See
|
||||||
|
# https://nixos.org/manual/nix/stable/release-notes/rl-2.19
|
||||||
|
if is_nix_version_2_19; then
|
||||||
|
$nixcmd flake update ymExe
|
||||||
|
else
|
||||||
|
$nixcmd flake lock --update-input ymExe
|
||||||
|
fi
|
||||||
|
if [[ $(git status --porcelain -- flake.lock) ]]; then
|
||||||
|
$nixcmd flake update
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "flake.nix was updated, but nix is not installed to update flake.lock"
|
echo "flake.nix was updated, but nix is not installed to update flake.lock"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user