Skip to content

Add lib.fileset.optional :: Bool -> FileSet -> FileSet #266106

@infinisil

Description

@infinisil

OT: I would quite like to have fileset.optional : Bool -> FileSet -> FileSet such that optional false x == fileset.empty. Example:

mkDerivation(finalAttrs: {
  src = fileset.unions [
    ./src
    (fileset.optional finalAttrs.doCheck ./tests)
  ];
})

Originally posted by @roberth in #265964 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: libThe Nixpkgs function library

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions