]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - scripts/update_flake
Add monitoring script with smartctl
[perso/Immae/Config/Nix.git] / scripts / update_flake
1 #!/usr/bin/env bash
2
3 searched_file="$1"
4
5 get_inputs() {
6 flake=$1
7 name=$2
8 cat "$flake" | jq -r --arg name "$name" '.nodes|to_entries[]|select(.value.original.path != null and (.value.original.path|test("(../)+" + $name)))|.key'
9 }
10
11 find flakes -name "flake.lock" | while read flake; do
12 for input in $(get_inputs "$flake" "$searched_file"); do
13 echo "updating $input in $(dirname "$flake")"
14 pushd "$(dirname "$flake")" >/dev/null 2>/dev/null
15 nix flake update --update-input "$input"
16 popd >/dev/null 2>/dev/null
17 done
18 done