Skip to content

Commit

Permalink
Create an out link to prevent garbage collection.
Browse files Browse the repository at this point in the history
It will create a garbage collection root as long as the symlink
created by `--out-link` exists.
  • Loading branch information
Profpatsch committed Aug 31, 2018
1 parent 1451c7a commit b8a32b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nixpkgs/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ def _nixpkgs_package_impl(ctx):
"-A", ctx.attr.attribute_path
if ctx.attr.nix_file or ctx.attr.nix_file_content
else ctx.attr.attribute_path or ctx.attr.name,
"--no-out-link",
# Creating an out link prevents nix from garbage collecting the store path.
# nixpkgs uses `nix-support/` for such house-keeping files, so we mirror them
# and use `bazel-support/`, under the assumption that no nix package has
# a file named `bazel-support` in its root.
# A `bazel clean` deletes the symlink and thus nix is free to garbage collect
# the store path.
"--out-link", "bazel-support/nix-out-link"
])

# If neither repository or path are set, leave empty which will use
Expand Down

0 comments on commit b8a32b6

Please sign in to comment.