# rebase is a helper which takes all files/dirs under oldroot, and # creates a new derivation with those files/dirs copied under newroot # (where newroot is a relative path to the root of the derivation). { stdenv, }: name: oldroot: newroot: stdenv.mkDerivation { inherit name oldroot newroot; builder = builtins.toFile "builder.sh" '' source $stdenv/setup mkdir -p "$out"/"$newroot" cp -rL "$oldroot"/* "$out"/"$newroot" ''; }