No description
Find a file
Robert Hensing 4064e43631 Add README
2019-05-12 16:51:42 +02:00
nix Pin nixpkgs and add CI 2019-05-12 16:37:34 +02:00
tests Add IFD-free gitignoreSource implementation 2019-05-12 13:48:32 +02:00
.gitignore Add IFD-free gitignoreSource implementation 2019-05-12 13:48:32 +02:00
ci.nix Pin nixpkgs and add CI 2019-05-12 16:37:34 +02:00
default.nix Add IFD-free gitignoreSource implementation 2019-05-12 13:48:32 +02:00
find-files.nix Add IFD-free gitignoreSource implementation 2019-05-12 13:48:32 +02:00
LICENSE Initialize with rules, test data and license from nix-gitignore 2019-05-12 12:03:30 +02:00
parse-git-config.nix Add IFD-free gitignoreSource implementation 2019-05-12 13:48:32 +02:00
README.md Add README 2019-05-12 16:51:42 +02:00
rules.nix Add IFD-free gitignoreSource implementation 2019-05-12 13:48:32 +02:00
shell.nix Pin nixpkgs and add CI 2019-05-12 16:37:34 +02:00

gitignore for Nix that just works

This project lets you include local sources in your Nix projects, while taking gitignore files into account.

'Installation'

let
  gitignoreSrc = pkgs.fetchFromGitHub { 
    owner = "hercules-ci";
    repo = "gitignore";
    # put the latest commit sha of gitignore Nix library here:
    rev = "";
    # use what nix suggests in the mismatch message here:
    sha256 = "sha256:0000000000000000000000000000000000000000000000000000";
  };
  inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource;
in
  <your nix expression>

or

niv add hercules-ci/gitignore

Usage

mkDerivation {
  name = "hello";
  src = gitignoreSource ./vendored/hello;
}

Features

  • Subdirectories just work
  • Hashes only change when output changes
  • Not impacted by large or inaccessible ignored directories
  • Composes with cleanSourceWith
  • Reads user git configuration; no need to bother your team with your tool config.
  • Also works with restrict-eval enabled (if avoiding fetchFromGitHub)
  • No import from derivation ("IFD")

Contributing

This project isn't perfect (yet) so please submit test cases and fixes as pull requests. Before doing anything drastic, it's a good idea to open an issue first to discuss and optimize the approach.

Thanks

A great shoutout to @siers for writing the intial test suite and rule translation code!