dotfiles/nixos/update-nixpkgs

22 lines
523 B
Bash
Executable file

#!/usr/bin/env bash
inputs=("nixpkgs" "nixpkgs-unstable" "nixpkgs-master")
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
inputs="$(for input in "${inputs[@]}"; do echo --update-input ${input} ; done)"
#nix flake update ${inputs}
bfs . -name "flake.nix" -print0 | perl -e 'print sort {$a=~s!/!/! <=> $b=~s!/!/!} <>' | while IFS= read -r -d '' flake
do
(
FLAKE_DIR="$(dirname "${flake}")"
echo "Updating ${FLAKE_DIR}"
cd "${FLAKE_DIR}"
nix flake update ${inputs}
)
done