Skip to content

Commit

Permalink
Only regenerate the files.* when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Théophane Hufschmitt committed May 29, 2024
1 parent d0052f4 commit 50e4fa2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/files.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ let nix = import "./nix-interop/nix.ncl" in
file_descr.materialisation_method
in
nix-s%"
rm -f %{target}
echo "Regenerating %{target}"
target_dir=$(dirname %{target})
test "${target_dir}" != "." && mkdir -p "${target_dir}"
# XXX: If `source.file` is set explicitely to a relative path
# and `materialisation_method` is `'Symlink`, this will link to the
# original file, not one in the store. Not sure that's what we want.
%{copy_command} %{file_descr.file} %{target}
if [[ ! -f "%{target}" ]] || [[ $(cat "%{target}") != $(cat "%{file_descr.file}") ]]; then
echo "Regenerating %{target}"
rm -f %{target}
target_dir=$(dirname "%{target}")
test "${target_dir}" != "." && mkdir -p "${target_dir}"
# XXX: If `source.file` is set explicitely to a relative path
# and `materialisation_method` is `'Symlink`, this will link to the
# original file, not one in the store. Not sure that's what we want.
%{copy_command} "%{file_descr.file}" "%{target}"
fi
"%
in
{
Expand Down

0 comments on commit 50e4fa2

Please sign in to comment.