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 Jun 21, 2024
1 parent a415c2e commit a32698b
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 @@ -54,14 +54,16 @@ let regenerate_files | Files -> nix.derivation.Derivation = fun files_to_generat
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
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}
fi
"%
in
{
Expand Down

0 comments on commit a32698b

Please sign in to comment.