Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support exact filer matching #40

Open
ollie-etl opened this issue Jun 23, 2023 · 1 comment
Open

Support exact filer matching #40

ollie-etl opened this issue Jun 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ollie-etl
Copy link

ollie-etl commented Jun 23, 2023

I'd like to be able to specify exact files such as

rec { 
  artifact_a = nix-filter {
     root = ../../;
     include = [
        ./relative/path/to/a.ext
        ./another/path/to/b.ext
     ];
  };
  
  artifact_b = nix-filter {
     root = ../../;
     include = [
        artifact_a
        ./third/path/to/c.ext
     ];
  };
}

And i'd expect the output for artifact_b to contain

relative/path/to/a.ext,
another/path/to/b.ext,
third/path/to/c.ext,

keeping the directory heirarchy.

Why?

It would allow the user to composable build src lists. Artifact A needs files x, y, artifact B needs A + file z, whilst maintaining their relative paths. Unsure how to achieve file level granularity currently

@ollie-etl ollie-etl added the enhancement New feature or request label Jun 23, 2023
@infinisil
Copy link

I'm currently working on a file set combinator library for Nixpkgs which allows you to do essentially this!

let
  commonFiles = lib.fileset.unions [
    ./relative/path/to/a.ext
    ./another/path/to/b.ext
  ];
in {
  a = lib.fileset.toSource {
    root = ../..;
    fileset = commonFiles;
  };
  b = lib.fileset.toSource {
    root = ../..;
    fileset = lib.fileset.union
      commonFiles
      ./third/path/to/c.ext;
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants