query
On this page

cleanSourceFilter

lib.sources.cleanSourceFilter

Docs pulled from | This Revision | 25 minutes ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

name: type:
    let
      baseName = baseNameOf name;
    in
    !(
      # Filter out version control software files/directories
      (
        baseName == ".git"
        ||
          type == "directory"
          && (
            baseName == ".svn"
            || baseName == "CVS"
            || baseName == ".hg"
            || baseName == ".jj"
            || baseName == ".pijul"
            || baseName == "_darcs"
          )
      )
      ||
        # Filter out editor backup / swap files.
        hasEmacsBackupFileSuffix baseName
      || match "^\\.sw[a-z]$" baseName != null
      || match "^\\..*\\.sw[a-z]$" baseName != null
      # Filter out generated files.
      || hasObjectSuffix baseName
      || hasSharedObjectSuffix baseName
      ||
        # Filter out nix-build result symlinks
        (type == "symlink" && hasResultPrefix baseName)
      ||
        # Filter out sockets and other types of files we can't have in the store.
        (type == "unknown")
    )